File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed
server/src/main/java/csembstu/alamgir/server/config Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 11package csembstu .alamgir .server .config ;
22
33import io .github .cdimascio .dotenv .Dotenv ;
4+ import io .github .cdimascio .dotenv .DotenvEntry ;
45
56public class EnvConfig {
67 public static void loadEnv () {
7-
88 Dotenv dotenv = Dotenv .configure ()
99 .ignoreIfMissing ()
1010 .load ();
1111
12- String dbhost = dotenv .get ("DB_HOST" );
13- String dbport = dotenv .get ("DB_PORT" );
14- String dbname = dotenv .get ("DB_NAME" );
15- String dbuser = dotenv .get ("DB_USER" );
16- String dbpassword = dotenv .get ("DB_PASSWORD" );
17-
18- System .setProperty ("DB_HOST" , dbhost );
19- System .setProperty ("DB_PORT" , dbport );
20- System .setProperty ("DB_NAME" , dbname );
21- System .setProperty ("DB_USER" , dbuser );
22- System .setProperty ("DB_PASSWORD" , dbpassword );
12+ for (DotenvEntry entry : dotenv .entries ()) {
13+ String key = entry .getKey ();
14+ String value = entry .getValue ();
2315
16+ if (value != null && !value .isEmpty ()) {
17+ System .setProperty (key , value );
18+ }
19+ }
2420 }
25- }
21+ }
You can’t perform that action at this time.
0 commit comments