mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-11 00:10:38 -07:00
feat: add server-side configuration with default theme (#90)
* docs: add example for usage of the main listenbrainz instance (#71) * docs: add example for usage of the main listenbrainz instance * Update scrobbler.md --------- Co-authored-by: Gabe Farrell <90876006+gabehf@users.noreply.github.com> * feat: add server-side cfg and default theme * fix: repair custom theme --------- Co-authored-by: m0d3rnX <jesper@posteo.de>
This commit is contained in:
parent
70f5198781
commit
1aeb6408aa
9 changed files with 86 additions and 26 deletions
|
|
@ -31,6 +31,7 @@ const (
|
|||
CONFIG_DIR_ENV = "KOITO_CONFIG_DIR"
|
||||
DEFAULT_USERNAME_ENV = "KOITO_DEFAULT_USERNAME"
|
||||
DEFAULT_PASSWORD_ENV = "KOITO_DEFAULT_PASSWORD"
|
||||
DEFAULT_THEME_ENV = "KOITO_DEFAULT_THEME"
|
||||
DISABLE_DEEZER_ENV = "KOITO_DISABLE_DEEZER"
|
||||
DISABLE_COVER_ART_ARCHIVE_ENV = "KOITO_DISABLE_COVER_ART_ARCHIVE"
|
||||
DISABLE_MUSICBRAINZ_ENV = "KOITO_DISABLE_MUSICBRAINZ"
|
||||
|
|
@ -60,6 +61,7 @@ type config struct {
|
|||
lbzRelayToken string
|
||||
defaultPw string
|
||||
defaultUsername string
|
||||
defaultTheme string
|
||||
disableDeezer bool
|
||||
disableCAA bool
|
||||
disableMusicBrainz bool
|
||||
|
|
@ -162,6 +164,8 @@ func loadConfig(getenv func(string) string, version string) (*config, error) {
|
|||
cfg.defaultPw = getenv(DEFAULT_PASSWORD_ENV)
|
||||
}
|
||||
|
||||
cfg.defaultTheme = getenv(DEFAULT_THEME_ENV)
|
||||
|
||||
cfg.configDir = getenv(CONFIG_DIR_ENV)
|
||||
if cfg.configDir == "" {
|
||||
cfg.configDir = "/etc/koito"
|
||||
|
|
@ -277,6 +281,12 @@ func DefaultUsername() string {
|
|||
return globalConfig.defaultUsername
|
||||
}
|
||||
|
||||
func DefaultTheme() string {
|
||||
lock.RLock()
|
||||
defer lock.RUnlock()
|
||||
return globalConfig.defaultTheme
|
||||
}
|
||||
|
||||
func FullImageCacheEnabled() bool {
|
||||
lock.RLock()
|
||||
defer lock.RUnlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue