mirror of
https://github.com/Luzifer/ots.git
synced 2025-04-19 06:55:51 -04:00
Add some small improvements
- Move application of fixes into loader function - Remove default fallback from frontend source - Fix documentation of default value in AppTitle Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
faccb174e3
commit
318ae9f79e
@ -39,7 +39,7 @@ In order to be adjustable to your needs there are some ways to customize your OT
|
||||
appIcon: ''
|
||||
|
||||
# Override the app-title, if unset or empty the default app-title
|
||||
# "OTS - One Time Secret" will be used
|
||||
# "OTS - One Time Secrets" will be used
|
||||
appTitle: ''
|
||||
|
||||
# Disable display of the app-title (for example if you included the
|
||||
|
21
customize.go
21
customize.go
@ -43,19 +43,22 @@ func loadCustomize(filename string) (customize, error) {
|
||||
}
|
||||
defer cf.Close()
|
||||
|
||||
return cust, errors.Wrap(
|
||||
yaml.NewDecoder(cf).Decode(&cust),
|
||||
"decoding customize file",
|
||||
)
|
||||
}
|
||||
|
||||
func (c *customize) defaults() {
|
||||
if len(c.AppTitle) == 0 {
|
||||
c.AppTitle = "OTS - One Time Secrets"
|
||||
if err = yaml.NewDecoder(cf).Decode(&cust); err != nil {
|
||||
return cust, errors.Wrap(err, "decoding customize file")
|
||||
}
|
||||
|
||||
cust.applyFixes()
|
||||
|
||||
return cust, nil
|
||||
}
|
||||
|
||||
func (c customize) ToJSON() (string, error) {
|
||||
j, err := json.Marshal(c)
|
||||
return string(j), errors.Wrap(err, "marshalling JSON")
|
||||
}
|
||||
|
||||
func (c *customize) applyFixes() {
|
||||
if len(c.AppTitle) == 0 {
|
||||
c.AppTitle = "OTS - One Time Secrets"
|
||||
}
|
||||
}
|
||||
|
1
main.go
1
main.go
@ -73,7 +73,6 @@ func initApp() error {
|
||||
if cust, err = loadCustomize(cfg.Customize); err != nil {
|
||||
return errors.Wrap(err, "loading customizations")
|
||||
}
|
||||
cust.defaults()
|
||||
|
||||
frontendFS, err := fs.Sub(embeddedAssets, "frontend")
|
||||
if err != nil {
|
||||
|
@ -18,7 +18,7 @@
|
||||
class="mr-1"
|
||||
:src="customize.appIcon"
|
||||
>
|
||||
<span v-if="!customize.disableAppTitle">{{ customize.appTitle || 'OTS - One Time Secrets' }}</span>
|
||||
<span v-if="!customize.disableAppTitle">{{ customize.appTitle }}</span>
|
||||
</b-navbar-brand>
|
||||
|
||||
<b-navbar-toggle target="nav-collapse" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user