Skip to content

Commit 2d0cd80

Browse files
committed
Add fetching of env variables
1 parent ee48bed commit 2d0cd80

File tree

1 file changed

+18
-0
lines changed
  • unidev-common/src/main/java/com/unidev/platform

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.unidev.platform;
2+
3+
public class Env {
4+
5+
public String env(String name, String defaultValue) {
6+
return System.getenv().getOrDefault(name, defaultValue);
7+
}
8+
9+
public String env(String name) {
10+
String value = System.getenv(name);
11+
12+
if (value == null) {
13+
throw new RuntimeException("No Env variable " + name);
14+
}
15+
16+
return value;
17+
}
18+
}

0 commit comments

Comments
 (0)