Skip to content

Commit 5cbdab7

Browse files
committed
make log clear when setting.CreateOrAppendToCustomConf
1 parent 620410c commit 5cbdab7

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

cmd/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func setPort(port string) error {
203203
defaultLocalURL += ":" + setting.HTTPPort + "/"
204204

205205
// Save LOCAL_ROOT_URL if port changed
206-
setting.CreateOrAppendToCustomConf(func(cfg *ini.File) {
206+
setting.CreateOrAppendToCustomConf("server.LOCAL_ROOT_URL", func(cfg *ini.File) {
207207
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
208208
})
209209
}

modules/setting/lfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func newLFSService() {
6262
}
6363

6464
// Save secret
65-
CreateOrAppendToCustomConf(func(cfg *ini.File) {
65+
CreateOrAppendToCustomConf("server.LFS_JWT_SECRET", func(cfg *ini.File) {
6666
cfg.Section("server").Key("LFS_JWT_SECRET").SetValue(LFS.JWTSecretBase64)
6767
})
6868
}

modules/setting/setting.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ func loadSecret(
11631163
if err != nil {
11641164
log.Fatal("Error trying to generate %s: %v", verbatimKey, err)
11651165
}
1166-
CreateOrAppendToCustomConf(func(cfg *ini.File) {
1166+
CreateOrAppendToCustomConf(sec.Name()+"."+verbatimKey, func(cfg *ini.File) {
11671167
cfg.Section(sec.Name()).Key(verbatimKey).SetValue(secret)
11681168
})
11691169
return secret
@@ -1272,7 +1272,7 @@ func MakeManifestData(appName, appURL, absoluteAssetURL string) []byte {
12721272

12731273
// CreateOrAppendToCustomConf creates or updates the custom config.
12741274
// Use the callback to set individual values.
1275-
func CreateOrAppendToCustomConf(callback func(cfg *ini.File)) {
1275+
func CreateOrAppendToCustomConf(purpose string, callback func(cfg *ini.File)) {
12761276
if CustomConf == "" {
12771277
log.Error("Custom config path must not be empty")
12781278
return
@@ -1299,7 +1299,7 @@ func CreateOrAppendToCustomConf(callback func(cfg *ini.File)) {
12991299
if err := cfg.SaveTo(CustomConf); err != nil {
13001300
log.Fatal("error saving to custom config: %v", err)
13011301
}
1302-
log.Info("Settings saved to: %q", CustomConf)
1302+
log.Info("Settings for %s saved to: %q", purpose, CustomConf)
13031303

13041304
// Change permissions to be more restrictive
13051305
fi, err := os.Stat(CustomConf)

services/auth/source/oauth2/jwtsigningkey.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ func loadOrCreateSymmetricKey() (interface{}, error) {
364364
return nil, err
365365
}
366366

367-
setting.CreateOrAppendToCustomConf(func(cfg *ini.File) {
367+
setting.CreateOrAppendToCustomConf("oauth2.JWT_SECRET", func(cfg *ini.File) {
368368
secretBase64 := base64.RawURLEncoding.EncodeToString(key)
369369
cfg.Section("oauth2").Key("JWT_SECRET").SetValue(secretBase64)
370370
})

0 commit comments

Comments
 (0)