Skip to content

Commit 0a27cf6

Browse files
committed
clearing/setting variables now a setting function for reuse
1 parent a0b8a3c commit 0a27cf6

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func NewMainApp(appVer AppVersion) *cli.App {
165165
app.Commands = append(app.Commands, subCmdWithConfig...)
166166
app.Commands = append(app.Commands, subCmdStandalone...)
167167

168-
_ = os.Unsetenv("XDG_CONFIG_HOME") // unset if set as HOME is managed by gitea
168+
setting.InitGiteaEnvVars()
169169
return app
170170
}
171171

models/unittest/testdb.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func InitSettings() {
5959
_ = hash.Register("dummy", hash.NewDummyHasher)
6060

6161
setting.PasswordHashAlgo, _ = hash.SetDefaultPasswordHashAlgorithm("dummy")
62+
setting.InitGiteaEnvVars()
6263
}
6364

6465
// TestOptions represents test options

modules/setting/config_env.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,8 @@ func EnvironmentToConfig(cfg ConfigProvider, envs []string) (changed bool) {
166166
}
167167
return changed
168168
}
169+
170+
// InitGiteaEnvVars initilises the environment for gitea
171+
func InitGiteaEnvVars() {
172+
_ = os.Unsetenv("XDG_CONFIG_HOME") // unset if set as HOME is managed by gitea
173+
}

0 commit comments

Comments
 (0)