mirror of
https://github.com/alice-lg/alice-lg.git
synced 2024-05-11 05:55:03 +00:00
added optional theme settings to config
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user