main
黄海 11 months ago
parent 3050633bb0
commit daeee59941

@ -19,8 +19,17 @@ public class Start extends JFinalConfig {
//通过构造函数读取配置文件
public Start() {
//配置文件
String configFile = "application_dev.yaml";
String myEnvVar = System.getenv("WORKING_ENV");
if (myEnvVar != null) {
configFile = configFile.replace("_dev", "_pro");
System.out.println("环境变量 WORKING_ENV 的值是: " + myEnvVar);
} else {
System.out.println("环境变量 WORKING_ENV 未设置");
}
Yaml yaml = new Yaml();
InputStream input = getClass().getClassLoader().getResourceAsStream("application_dev.yaml");
InputStream input = getClass().getClassLoader().getResourceAsStream(configFile);
if (input == null) {
System.out.println("Sorry, unable to find application.yaml");
return;

Loading…
Cancel
Save