Skip to content

Commit bc2bd67

Browse files
committed
Added setting description
1 parent 5ec02d8 commit bc2bd67

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

backend/embed/migrations/20201013035318_initial_schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ CREATE TABLE IF NOT EXISTS `setting`
3232
created_on INTEGER NOT NULL DEFAULT 0,
3333
modified_on INTEGER NOT NULL DEFAULT 0,
3434
name TEXT NOT NULL,
35+
description TEXT NOT NULL,
3536
value TEXT NOT NULL,
3637
UNIQUE (name)
3738
);

backend/embed/migrations/20201013035839_initial_data.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,31 @@ INSERT INTO `setting` (
55
created_on,
66
modified_on,
77
name,
8+
description,
89
value
910
) VALUES (
1011
strftime('%s', 'now'),
1112
strftime('%s', 'now'),
1213
"error-reporting",
14+
"If enabled, any application errors are reported to Sentry. Sensitive information is not sent. All information sent is also private.",
1315
"true"
1416
);
1517

18+
-- Default site
19+
INSERT INTO `setting` (
20+
created_on,
21+
modified_on,
22+
name,
23+
description,
24+
value
25+
) VALUES (
26+
strftime('%s', 'now'),
27+
strftime('%s', 'now'),
28+
"default-site",
29+
"What to show users who hit your Nginx server by default",
30+
"welcome"
31+
);
32+
1633
-- Default Certificate Authorities
1734

1835
INSERT INTO `certificate_authority` (

backend/internal/entity/setting/apply.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ func ApplySettings() {
1010
logger.Debug("Applying Settings")
1111

1212
// Error-reporting
13-
m, _ := GetByName("error-reporting")
14-
config.ErrorReporting = m.Value.Decoded.(bool)
13+
m, err := GetByName("error-reporting")
14+
if err != nil {
15+
logger.Error("ApplySettingsError", err)
16+
} else {
17+
config.ErrorReporting = m.Value.Decoded.(bool)
18+
}
1519
}

backend/internal/entity/setting/model.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ const (
1515

1616
// Model is the user model
1717
type Model struct {
18-
ID int `json:"id" db:"id" filter:"id,integer"`
19-
CreatedOn types.DBDate `json:"created_on" db:"created_on" filter:"created_on,integer"`
20-
ModifiedOn types.DBDate `json:"modified_on" db:"modified_on" filter:"modified_on,integer"`
21-
Name string `json:"name" db:"name" filter:"name,string"`
22-
Value types.JSONB `json:"value" db:"value"`
18+
ID int `json:"id" db:"id" filter:"id,integer"`
19+
CreatedOn types.DBDate `json:"created_on" db:"created_on" filter:"created_on,integer"`
20+
ModifiedOn types.DBDate `json:"modified_on" db:"modified_on" filter:"modified_on,integer"`
21+
Name string `json:"name" db:"name" filter:"name,string"`
22+
Description string `json:"description" db:"description" filter:"description,string"`
23+
Value types.JSONB `json:"value" db:"value"`
2324
}
2425

2526
func (m *Model) getByQuery(query string, params []interface{}) error {

0 commit comments

Comments
 (0)