This repository was archived by the owner on Jul 10, 2024. It is now read-only.
File tree 2 files changed +15
-1
lines changed
submarine-commons/commons-utils/src/main/java/org/apache/submarine/commons/utils
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 22
22
VERSION : " 0.9.0-SNAPSHOT"
23
23
BUILD_FLAG : " clean install -ntp -DskipTests -am"
24
24
TEST_FLAG : " test -DskipRat -ntp"
25
+ SUBMARINE_AUTH_SECRET : " SUBMARINE_SECRET_12345678901234567890"
25
26
jobs :
26
27
generate-k8s-versions-array :
27
28
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 23
23
24
24
public class SubmarineConfVars {
25
25
private static final Logger LOG = LoggerFactory .getLogger (SubmarineConfVars .class );
26
+ /**
27
+ * Retrieves the secret from the environment variable "SUBMARINE_AUTH_DEFAULT_SECRET".
28
+ * Throws runtimeException if the environment variable is not set or empty.
29
+ *
30
+ * @return The secret as a String
31
+ */
32
+ private static String getSecretFromEnv () {
33
+ String secret = System .getenv ("SUBMARINE_AUTH_SECRET" );
34
+ if (secret == null || secret .isEmpty ()) {
35
+ secret = "" ;
36
+ }
37
+ return secret ;
38
+ }
26
39
public enum ConfVars {
27
40
SUBMARINE_CONF_DIR ("submarine.conf.dir" , "conf" ),
28
41
SUBMARINE_LOCALIZATION_MAX_ALLOWED_FILE_SIZE_MB (
@@ -93,7 +106,7 @@ public enum ConfVars {
93
106
94
107
/* auth */
95
108
SUBMARINE_AUTH_TYPE ("submarine.auth.type" , "simple" ),
96
- SUBMARINE_AUTH_DEFAULT_SECRET ("submarine.auth.default.secret" , "SUBMARINE_SECRET_12345678901234567890" ),
109
+ SUBMARINE_AUTH_DEFAULT_SECRET ("submarine.auth.default.secret" , getSecretFromEnv () ),
97
110
SUBMARINE_AUTH_MAX_AGE_ENV ("submarine.auth.maxAge" , 60 * 60 * 24 );
98
111
99
112
private String varName ;
You can’t perform that action at this time.
0 commit comments