From 78fe4481099fcf6666f1a259e38d9d828a253347 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Sat, 30 Aug 2025 00:36:46 +0700 Subject: feat: add persistent storage for likes --- config/config.go | 12 +++++++++++- config/config.local.yaml | 4 ++-- config/config.prod.yaml | 2 +- config/config.stage.yaml | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'config') diff --git a/config/config.go b/config/config.go index fe0ac72..7438fe1 100644 --- a/config/config.go +++ b/config/config.go @@ -41,7 +41,17 @@ type AvailableLanguageConfig struct { } type AuthConfig struct { - Salt string `json:"Salt" yaml:"salt" validate:"required"` + Salt string `json:"Salt" yaml:"salt" validate:"required"` + Db DbConfig `json:"Db" yaml:"db" validate:"required"` +} + +type DbConfig struct { + Type string `json:"Type" yaml:"type" validate:"required,oneof=sqlite3"` + Cfg Sqlite3Config `json:"Config" yaml:"config"` +} + +type Sqlite3Config struct { + DSN string `json:"DSN" yaml:"dsn" validate:"required"` } func LoadConfig(path string, config *Config) error { diff --git a/config/config.local.yaml b/config/config.local.yaml index 330e29c..0b48e47 100644 --- a/config/config.local.yaml +++ b/config/config.local.yaml @@ -20,7 +20,7 @@ availableLanguages: locFile: localization.en.yaml auth: db: - type: sqlite + type: sqlite3 config: - dsn: 'file:/data/auth.db?cache=shared&mode=memory' + dsn: 'file:/tmp/auth.db?cache=shared&mode=rwc' salt: '123' diff --git a/config/config.prod.yaml b/config/config.prod.yaml index 76288fa..e1294c0 100644 --- a/config/config.prod.yaml +++ b/config/config.prod.yaml @@ -20,7 +20,7 @@ availableLanguages: locFile: localization.en.yaml auth: db: - type: sqlite + type: sqlite3 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 f6c16cb..30233c1 100644 --- a/config/config.stage.yaml +++ b/config/config.stage.yaml @@ -20,7 +20,7 @@ availableLanguages: locFile: localization.en.yaml auth: db: - type: sqlite + type: sqlite3 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