Diffstat (limited to 'config')
| -rw-r--r-- | config/config.go | 16 | ||||
| -rw-r--r-- | config/config.prod.yaml | 20 | ||||
| -rw-r--r-- | config/config.stage.yaml | 20 | ||||
| -rw-r--r-- | config/config.yaml | 17 |
4 files changed, 24 insertions, 49 deletions
diff --git a/config/config.go b/config/config.go index 8c0321e..67c0c4d 100644 --- a/config/config.go +++ b/config/config.go @@ -9,14 +9,13 @@ import ( ) type Config struct { - LogLevel slog.Level `json:"LogLevel" yaml:"logLevel" validate:"required"` - BlogPages BlogPagesConfig `json:"BlogPages" yaml:"blogPages" validate:"required"` - LocalePath string `json:"LocalePath" yaml:"localePath" validate:"required,filepath"` - AvailableLanguages []AvailableLanguageConfig `json:"AvailableLanguages" yaml:"availableLanguages" validate:"required"` + LogLevel slog.Level `json:"LogLevel" yaml:"logLevel" validate:"required"` + BlogPages BlogPagesConfig `json:"BlogPages" yaml:"blogPages" validate:"required"` } type BlogPagesConfig struct { - Storage StorageConfig `json:"Storage" yaml:"storage" validate:"required"` + Storage StorageConfig `json:"Storage" yaml:"storage" validate:"required"` + AvailableLanguages []AvailableLanguageConfig `json:"AvailableLanguages" yaml:"availableLanguages" validate:"required"` } type StorageConfig struct { @@ -33,10 +32,9 @@ type B2Config struct { } type AvailableLanguageConfig struct { - Name string `json:"Name" yaml:"name" validate:"required"` - Alt string `json:"Alt" yaml:"alt"` - Flag string `json:"Flag" yaml:"flag" validate:"url"` - LocFile string `json:"LocFile" yaml:"locFile" validate:"required,filepath"` + Name string `json:"Name" yaml:"name" validate:"required"` + Alt string `json:"Alt" yaml:"alt"` + Flag string `json:"Flag" yaml:"flag" validate:"url"` } func LoadConfig(path string, config *Config) error { diff --git a/config/config.prod.yaml b/config/config.prod.yaml deleted file mode 100644 index 2d050bf..0000000 --- a/config/config.prod.yaml +++ /dev/null @@ -1,20 +0,0 @@ -logLevel: info -blogPages: - storage: - type: b2 - config: - bucketName: sayana-pages - region: eu-central-003 - prefix: 'prod-' - keyID: '${B2_KEY_ID}' - applicationKey: '${B2_APPLICATION_KEY}' -localePath: ./locale/ -availableLanguages: - - name: ru - alt: Русский - flag: https://f003.backblazeb2.com/file/sayana-static/flags/ru.svg - locFile: localization.ru.yaml - - name: en - alt: English - flag: https://f003.backblazeb2.com/file/sayana-static/flags/gb.svg - locFile: localization.en.yaml diff --git a/config/config.stage.yaml b/config/config.stage.yaml deleted file mode 100644 index a34a33e..0000000 --- a/config/config.stage.yaml +++ /dev/null @@ -1,20 +0,0 @@ -logLevel: debug -blogPages: - storage: - type: b2 - config: - bucketName: sayana-pages - region: eu-central-003 - prefix: 'stage-' - keyID: '${B2_KEY_ID}' - applicationKey: '${B2_APPLICATION_KEY}' -localePath: ./locale/ -availableLanguages: - - name: ru - alt: Русский - flag: https://f003.backblazeb2.com/file/sayana-static/flags/ru.svg - locFile: localization.ru.yaml - - name: en - alt: English - flag: https://f003.backblazeb2.com/file/sayana-static/flags/gb.svg - locFile: localization.en.yaml diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..908bfe2 --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,17 @@ +logLevel: debug +blogPages: + storage: + type: b2 + config: + bucketName: sayana-pages + region: eu-central-003 + prefix: '' + keyID: '${B2_KEY_ID}' + applicationKey: '${B2_APPLICATION_KEY}' + availableLanguages: + - name: ru + alt: Русский + flag: https://f003.backblazeb2.com/file/sayana-static/flags/ru.svg + - name: en + alt: English + flag: https://f003.backblazeb2.com/file/sayana-static/flags/gb.svg |