This commit is contained in:
2026-08-17 02:12:17 +08:00
parent 560ae46b82
commit 6a05803e08
96 changed files with 2888 additions and 685 deletions
+11 -5
View File
@@ -172,11 +172,12 @@ func (d *Data) persistConfigValuesLocked(dataConfig *conf.Data, adminConfig *con
return writeConfigDocument(configPath, &document)
}
// persistDatabaseConfig writes only the database selected on the init page.
// Initialization must not serialize the partially populated runtime config
// back over the template: doing so removes all omitted/default settings from
// data and admin and leaves the next startup with no visible configuration.
func (d *Data) persistDatabaseConfig(database *conf.Data_Database) error {
// persistDatabaseConfig writes only the database selected on the init page and
// the freshly generated JWT signing key. Initialization must not serialize the
// partially populated runtime config back over the template: doing so removes
// all omitted/default settings from data and admin and leaves the next startup
// with no visible configuration.
func (d *Data) persistDatabaseConfig(database *conf.Data_Database, signingKey string) error {
d.configMu.Lock()
defer d.configMu.Unlock()
@@ -215,6 +216,11 @@ func (d *Data) persistDatabaseConfig(database *conf.Data_Database) error {
if err = setYAMLMapping(&document, "data", map[string]any{"database": databaseValue}); err != nil {
return err
}
if signingKey != "" {
if err = setYAMLMapping(&document, "admin", map[string]any{"jwt": map[string]any{"signing_key": signingKey}}); err != nil {
return err
}
}
return writeConfigDocument(configPath, &document)
}