Added setting description

This commit is contained in:
Jamie Curnow
2021-07-26 11:58:57 +10:00
parent 5ec02d8cb0
commit bc2bd67cda
4 changed files with 30 additions and 7 deletions

View File

@@ -32,6 +32,7 @@ CREATE TABLE IF NOT EXISTS `setting`
created_on INTEGER NOT NULL DEFAULT 0,
modified_on INTEGER NOT NULL DEFAULT 0,
name TEXT NOT NULL,
description TEXT NOT NULL,
value TEXT NOT NULL,
UNIQUE (name)
);

View File

@@ -5,14 +5,31 @@ INSERT INTO `setting` (
created_on,
modified_on,
name,
description,
value
) VALUES (
strftime('%s', 'now'),
strftime('%s', 'now'),
"error-reporting",
"If enabled, any application errors are reported to Sentry. Sensitive information is not sent. All information sent is also private.",
"true"
);
-- Default site
INSERT INTO `setting` (
created_on,
modified_on,
name,
description,
value
) VALUES (
strftime('%s', 'now'),
strftime('%s', 'now'),
"default-site",
"What to show users who hit your Nginx server by default",
"welcome"
);
-- Default Certificate Authorities
INSERT INTO `certificate_authority` (

View File

@@ -10,6 +10,10 @@ func ApplySettings() {
logger.Debug("Applying Settings")
// Error-reporting
m, _ := GetByName("error-reporting")
m, err := GetByName("error-reporting")
if err != nil {
logger.Error("ApplySettingsError", err)
} else {
config.ErrorReporting = m.Value.Decoded.(bool)
}
}

View File

@@ -19,6 +19,7 @@ type Model struct {
CreatedOn types.DBDate `json:"created_on" db:"created_on" filter:"created_on,integer"`
ModifiedOn types.DBDate `json:"modified_on" db:"modified_on" filter:"modified_on,integer"`
Name string `json:"name" db:"name" filter:"name,string"`
Description string `json:"description" db:"description" filter:"description,string"`
Value types.JSONB `json:"value" db:"value"`
}