override config entries with cli args

use getconfig instead of settings file
This commit is contained in:
2021-09-09 23:33:04 +02:00
parent 2706929bb4
commit aa49d601ab
7 changed files with 156 additions and 111 deletions

View File

@ -5,23 +5,14 @@ import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"openmediacenter/apiGo/api/types"
"openmediacenter/apiGo/config"
)
var db *sql.DB
var DBName string
// store the command line parameter for Videoprefix
var SettingsVideoPrefix = ""
type DatabaseConfig struct {
DBHost string
DBPort int
DBUser string
DBPassword string
DBName string
}
func InitDB(dbconf *DatabaseConfig) {
func InitDB() {
dbconf := config.GetConfig().Database
DBName = dbconf.DBName
// Open up our database connection.
@ -128,6 +119,6 @@ func GetSettings() (result types.SettingsType, PathPrefix string, sizes types.Se
result.TMDBGrabbing = TMDBGrabbing != 0
result.PasswordEnabled = result.Password != "-1"
result.DarkMode = DarkMode != 0
PathPrefix = SettingsVideoPrefix
PathPrefix = config.GetConfig().General.ReindexPrefix
return
}

View File

@ -1,20 +0,0 @@
package settings
var tvShowEnabled bool
var videosDeletable bool
func TVShowsEnabled() bool {
return tvShowEnabled
}
func SetTVShowEnabled(enabled bool) {
tvShowEnabled = enabled
}
func VideosDeletable() bool {
return videosDeletable
}
func SetVideosDeletable(deletable bool) {
videosDeletable = deletable
}