mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-09 03:08:05 +02:00
refactor: "install" page (#39400)
1. remove useless options 2. set AppDataPath instead of repo root path 3. make "disable self-registration" default enabled 4. avoid writing corrupted ini file 5. avoid auto-sign-in the existing admin user
This commit is contained in:
1 parent
71065941a9
commit
f14cedc4fa
35 files changed
+261
-439
No files matched your search
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"gitea.dev/models/unittest"
|
||||
"gitea.dev/modules/setting"
|
||||
"gitea.dev/services/contexttest"
|
||||
"gitea.dev/services/forms"
|
||||
|
||||
@@ -59,4 +60,14 @@ func TestFillInstallConfig(t *testing.T) {
|
||||
assert.NotEmpty(t, cfg.Section("oauth2").Key("JWT_SECRET").String())
|
||||
assert.Empty(t, cfg.Section("oauth2").Key("JWT_SECRET_URI").String())
|
||||
})
|
||||
t.Run("CleanUp", func(t *testing.T) {
|
||||
tmpFile := t.TempDir() + "/test.ini"
|
||||
f := &forms.InstallForm{AppName: "foo\x00\r\nbar"}
|
||||
cfg := fillInstallConfig(ctx, []string{}, f)
|
||||
err := cfg.SaveTo(tmpFile)
|
||||
assert.NoError(t, err)
|
||||
ini, err := setting.NewConfigProviderFromFile(tmpFile)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, `foo bar`, ini.Section("").Key("APP_NAME").String())
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user