feat: optional MySQL/MariaDB database driver for deployments that cannot use local SQLite
This commit is contained in:
1 parent
81e299f09a
commit
d752a61e52
35 files changed
+2896
-76
No files matched your search
@@ -28,6 +28,8 @@ type Settings struct {
|
||||
UploadDir string
|
||||
JWTSecret string
|
||||
DBFile string
|
||||
Database DatabaseSettings
|
||||
DataDirPath string
|
||||
Port string
|
||||
Smtp SmtpSettings
|
||||
AuthRateLimit AuthRateLimitSettings
|
||||
@@ -38,6 +40,9 @@ type Settings struct {
|
||||
}
|
||||
|
||||
func (s Settings) DataDir() string {
|
||||
if s.DataDirPath != "" {
|
||||
return s.DataDirPath
|
||||
}
|
||||
return filepath.Dir(s.DBFile)
|
||||
}
|
||||
|
||||
@@ -61,6 +66,11 @@ func NewSettingsFromEnv() (Settings, error) {
|
||||
return Settings{}, err
|
||||
}
|
||||
|
||||
database, err := databaseSettingsFromEnv()
|
||||
if err != nil {
|
||||
return Settings{}, err
|
||||
}
|
||||
|
||||
return Settings{
|
||||
Environment: os.Getenv("ENVIRONMENT"),
|
||||
CorsAllowedOrigins: parseSemicolonSeparatedList(os.Getenv("CORS_ALLOWED_ORIGINS")),
|
||||
@@ -68,6 +78,8 @@ func NewSettingsFromEnv() (Settings, error) {
|
||||
UploadDir: os.Getenv("UPLOAD_DIR"),
|
||||
JWTSecret: os.Getenv("JWT_SECRET"),
|
||||
DBFile: os.Getenv("DB_FILE"),
|
||||
Database: database,
|
||||
DataDirPath: os.Getenv("DATA_DIR"),
|
||||
Port: os.Getenv("PORT"),
|
||||
Smtp: SmtpSettings{
|
||||
Login: os.Getenv("SMTP_LOGIN"),
|
||||
|
||||
Reference in new issue
Block a user