This commit is contained in:
Graham Steffaniak 2023-09-01 17:53:22 -05:00
parent 3fb940ba5b
commit 5c860a45e1
4 changed files with 5 additions and 7 deletions

View File

@ -82,10 +82,8 @@ Also, if the database path doesn't exist, File Browser will enter into
the quick setup mode and a new database will be bootstraped and a new
user created with the credentials from options "username" and "password".`,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
settings.Initialize()
serverConfig := settings.GlobalConfiguration.Server
log.Println(cfgFile)
if !d.hadDB {
quickSetup(cmd.Flags(), d)
}

View File

@ -85,8 +85,7 @@ func dbExists(path string) (bool, error) {
func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
return func(cmd *cobra.Command, args []string) {
data := pythonData{hadDB: true}
path := getParam(cmd.Flags(), "database")
path := settings.GlobalConfiguration.Server.Database
exists, err := dbExists(path)
if err != nil {
@ -100,6 +99,7 @@ func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
data.hadDB = exists
db, err := storm.Open(path)
checkErr(err)
defer db.Close()
data.store, err = bolt.NewStorage(db)
checkErr(err)

View File

@ -1,9 +1,9 @@
server:
port: 8050
baseURL: /
#baseURL: /
address: ''
log: stdout
database: ./database.db
database: database.db
root: /srv
general:
disable-thumbnails: false

View File

@ -10,7 +10,7 @@ import (
var GlobalConfiguration Settings
func Initialize() {
func init() {
// Open and read the YAML file
yamlFile, err := os.Open("filebrowser.yml")
if err != nil {