File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,9 @@ func loadCommonSettingsFrom(cfg ConfigProvider) {
250
250
loadLogFrom (cfg )
251
251
loadServerFrom (cfg )
252
252
loadSSHFrom (cfg )
253
+
254
+ mustCurrentRunUserMatch (cfg ) // it depends on the SSH config, only non-builtin SSH server requires this check
255
+
253
256
loadOAuth2From (cfg )
254
257
loadSecurityFrom (cfg )
255
258
loadAttachmentFrom (cfg )
@@ -282,14 +285,6 @@ func loadRunModeFrom(rootCfg ConfigProvider) {
282
285
RunMode = rootSec .Key ("RUN_MODE" ).MustString ("prod" )
283
286
}
284
287
IsProd = strings .EqualFold (RunMode , "prod" )
285
- // Does not check run user when the install lock is off.
286
- installLock := rootCfg .Section ("security" ).Key ("INSTALL_LOCK" ).MustBool (false )
287
- if installLock {
288
- currentUser , match := IsRunUserMatchCurrentUser (RunUser )
289
- if ! match {
290
- log .Fatal ("Expect user '%s' but current user is: %s" , RunUser , currentUser )
291
- }
292
- }
293
288
294
289
// check if we run as root
295
290
if os .Getuid () == 0 {
@@ -301,6 +296,17 @@ func loadRunModeFrom(rootCfg ConfigProvider) {
301
296
}
302
297
}
303
298
299
+ func mustCurrentRunUserMatch (rootCfg ConfigProvider ) {
300
+ // Does not check run user when the "InstallLock" is off.
301
+ installLock := rootCfg .Section ("security" ).Key ("INSTALL_LOCK" ).MustBool (false )
302
+ if installLock {
303
+ currentUser , match := IsRunUserMatchCurrentUser (RunUser )
304
+ if ! match {
305
+ log .Fatal ("Expect user '%s' but current user is: %s" , RunUser , currentUser )
306
+ }
307
+ }
308
+ }
309
+
304
310
// LoadSettings initializes the settings for normal start up
305
311
func LoadSettings () {
306
312
loadDBSetting (CfgProvider )
You can’t perform that action at this time.
0 commit comments