summaryrefslogtreecommitdiffci
path: root/config
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2025-08-26 00:39:22 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2025-08-26 00:39:22 +0700
commit5ed2499a1d8806fe78369b5b492d7990218131c9 (patch)
tree0a9e0548aa145986b654af81554f16c8cf544c41 /config
parentb815b74d7a943d1f71a0ddcf6b343d3958d2b97a (diff)
downloadweb-5ed2499a1d8806fe78369b5b492d7990218131c9.tar.gz
web-5ed2499a1d8806fe78369b5b492d7990218131c9.zip
feat: client hash cache
feat: add local config feat: create a volume for data (for the future) format: unname unused vars
Diffstat (limited to 'config')
-rw-r--r--config/config.go5
-rw-r--r--config/config.local.yaml26
-rw-r--r--config/config.prod.yaml6
-rw-r--r--config/config.stage.yaml6
4 files changed, 43 insertions, 0 deletions
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}'