From 5ed2499a1d8806fe78369b5b492d7990218131c9 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Tue, 26 Aug 2025 00:39:22 +0700 Subject: feat: client hash cache feat: add local config feat: create a volume for data (for the future) format: unname unused vars --- config/config.go | 5 +++++ config/config.local.yaml | 26 ++++++++++++++++++++++++++ config/config.prod.yaml | 6 ++++++ config/config.stage.yaml | 6 ++++++ 4 files changed, 43 insertions(+) create mode 100644 config/config.local.yaml (limited to 'config') diff --git a/config/config.go b/config/config.go index 8c0321e..fe0ac72 100644 --- a/config/config.go +++ b/config/config.go @@ -13,6 +13,7 @@ type Config struct { 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"` + Auth AuthConfig `json:"Auth" yaml:"auth" validate:"required"` } type BlogPagesConfig struct { @@ -39,6 +40,10 @@ type AvailableLanguageConfig struct { LocFile string `json:"LocFile" yaml:"locFile" validate:"required,filepath"` } +type AuthConfig struct { + Salt string `json:"Salt" yaml:"salt" validate:"required"` +} + func LoadConfig(path string, config *Config) error { fileBytes, err := os.ReadFile(path) if err != nil { diff --git a/config/config.local.yaml b/config/config.local.yaml new file mode 100644 index 0000000..330e29c --- /dev/null +++ b/config/config.local.yaml @@ -0,0 +1,26 @@ +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 +auth: + db: + type: sqlite + config: + dsn: 'file:/data/auth.db?cache=shared&mode=memory' + salt: '123' diff --git a/config/config.prod.yaml b/config/config.prod.yaml index 2d050bf..76288fa 100644 --- a/config/config.prod.yaml +++ b/config/config.prod.yaml @@ -18,3 +18,9 @@ availableLanguages: alt: English flag: https://f003.backblazeb2.com/file/sayana-static/flags/gb.svg locFile: localization.en.yaml +auth: + db: + type: sqlite + config: + dsn: 'file:/data/auth.db?cache=private&mode=rwc&_locking_mode=EXCLUSIVE&_mutex=no&_auto_vacuum=2' + salt: '${AUTH_SALT}' diff --git a/config/config.stage.yaml b/config/config.stage.yaml index a34a33e..f6c16cb 100644 --- a/config/config.stage.yaml +++ b/config/config.stage.yaml @@ -18,3 +18,9 @@ availableLanguages: alt: English flag: https://f003.backblazeb2.com/file/sayana-static/flags/gb.svg locFile: localization.en.yaml +auth: + db: + type: sqlite + config: + dsn: 'file:/data/auth.db?cache=private&mode=rwc&_locking_mode=EXCLUSIVE&_mutex=no&_auto_vacuum=2' + salt: '${AUTH_SALT}' -- cgit v1.3.1+13