Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/#3 #5

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.wable.www.WableServer.common.util;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.services.s3.endpoints.internal.Value;

@Component
public class EnvironmentLogger implements CommandLineRunner {

private static final Logger logger = LoggerFactory.getLogger(EnvironmentLogger.class);

private final Environment environment;

public EnvironmentLogger(Environment environment) {
this.environment = environment;
}

@Override
public void run(String... args) throws Exception {
String dbUrl = environment.getProperty("spring.datasource.url");
String dbUser = environment.getProperty("spring.datasource.username");
String dbPw = environment.getProperty("spring.datasource.password");
String activeProfile = environment.getProperty("spring.profiles.active");

System.out.println("Active Profile: " + activeProfile);
System.out.println("Database URL: " + dbUrl);
System.out.println("Database Username: " + dbUser);
System.out.println("Database Passeord: " + dbPw);
}
}
Loading