From 5895255f4314817e9ef7f57e5febe62facb63661 Mon Sep 17 00:00:00 2001 From: Matthias Hannig Date: Wed, 20 Jun 2018 11:07:07 +0200 Subject: [PATCH] added optional theme settings to config --- backend/config.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/backend/config.go b/backend/config.go index c8c6c5c..7beaa80 100644 --- a/backend/config.go +++ b/backend/config.go @@ -40,6 +40,12 @@ type UiConfig struct { RoutesRejections RejectionsConfig RoutesNoexports NoexportsConfig + + Theme ThemeConfig +} + +type ThemeConfig struct { + Path string `ini:"path"` } type SourceConfig struct { @@ -150,6 +156,16 @@ func getRoutesNoexports(config *ini.File) (NoexportsConfig, error) { return noexportsConfig, nil } +// Get UI config: Theme settings +func getThemeConfig(config *ini.File) ThemeConfig { + baseConfig := config.Section("theme") + + themeConfig := ThemeConfig{} + baseConfig.MapTo(&themeConfig) + + return themeConfig +} + // Get the UI configuration from the config file func getUiConfig(config *ini.File) (UiConfig, error) { uiConfig := UiConfig{} @@ -171,11 +187,19 @@ func getUiConfig(config *ini.File) (UiConfig, error) { return uiConfig, err } + // Theme configuration: Theming is optional, if no settings + // are found, it will be ignored + themeConfig := getThemeConfig(config) + + fmt.Println("THEME COINFIG:", themeConfig) + // Make config uiConfig = UiConfig{ RoutesColumns: routesColumns, RoutesRejections: rejections, RoutesNoexports: noexports, + + Theme: themeConfig, } return uiConfig, nil