mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix: update demo database and app.ini; enhance: migration
This commit is contained in:
parent
f8e17dc7e4
commit
925e61abf4
8 changed files with 85 additions and 15 deletions
|
@ -4,7 +4,9 @@ type Database struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
var DatabaseSettings = &Database{}
|
||||
var DatabaseSettings = &Database{
|
||||
Name: "database",
|
||||
}
|
||||
|
||||
func (d *Database) GetName() string {
|
||||
return d.Name
|
||||
|
|
|
@ -74,6 +74,10 @@ func (v1 *serverV1) migrateToV2() (v2 *settingsV2) {
|
|||
v2.Http.InsecureSkipVerify = v1.InsecureSkipVerify
|
||||
v2.Node.Name = v1.Name
|
||||
|
||||
if v1.Database == "" {
|
||||
v2.DataBase.Name = "database"
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ StartCmd = bash
|
|||
Database = database
|
||||
CADir = /test
|
||||
GithubProxy = https://mirror.ghproxy.com/
|
||||
Secret = newSecret
|
||||
Secret = newSecret
|
||||
Demo = false
|
||||
PageSize = 20
|
||||
HttpHost = 0.0.0.0
|
||||
|
|
|
@ -43,6 +43,7 @@ func init() {
|
|||
t := time.Unix(cast.ToInt64(buildTime), 0)
|
||||
LastModified = strings.ReplaceAll(t.Format(time.RFC1123), "UTC", "GMT")
|
||||
|
||||
sections.Set("database", DatabaseSettings)
|
||||
sections.Set("auth", AuthSettings)
|
||||
sections.Set("casdoor", CasdoorSettings)
|
||||
sections.Set("cert", CertSettings)
|
||||
|
@ -86,7 +87,7 @@ func Init() {
|
|||
func Save() (err error) {
|
||||
// fix unable to save empty slice
|
||||
if len(CertSettings.RecursiveNameservers) == 0 {
|
||||
settings.Conf.Section("server").Key("RecursiveNameservers").SetValue("")
|
||||
settings.Conf.Section("cert").Key("RecursiveNameservers").SetValue("")
|
||||
}
|
||||
|
||||
err = settings.Save()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue