new
This commit is contained in:
parent
3fb940ba5b
commit
5c860a45e1
|
@ -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
|
the quick setup mode and a new database will be bootstraped and a new
|
||||||
user created with the credentials from options "username" and "password".`,
|
user created with the credentials from options "username" and "password".`,
|
||||||
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
||||||
settings.Initialize()
|
|
||||||
serverConfig := settings.GlobalConfiguration.Server
|
serverConfig := settings.GlobalConfiguration.Server
|
||||||
log.Println(cfgFile)
|
log.Println(cfgFile)
|
||||||
|
|
||||||
if !d.hadDB {
|
if !d.hadDB {
|
||||||
quickSetup(cmd.Flags(), d)
|
quickSetup(cmd.Flags(), d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,8 +85,7 @@ func dbExists(path string) (bool, error) {
|
||||||
func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
|
func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
|
||||||
return func(cmd *cobra.Command, args []string) {
|
return func(cmd *cobra.Command, args []string) {
|
||||||
data := pythonData{hadDB: true}
|
data := pythonData{hadDB: true}
|
||||||
|
path := settings.GlobalConfiguration.Server.Database
|
||||||
path := getParam(cmd.Flags(), "database")
|
|
||||||
exists, err := dbExists(path)
|
exists, err := dbExists(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -100,6 +99,7 @@ func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
|
||||||
data.hadDB = exists
|
data.hadDB = exists
|
||||||
db, err := storm.Open(path)
|
db, err := storm.Open(path)
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
data.store, err = bolt.NewStorage(db)
|
data.store, err = bolt.NewStorage(db)
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
server:
|
server:
|
||||||
port: 8050
|
port: 8050
|
||||||
baseURL: /
|
#baseURL: /
|
||||||
address: ''
|
address: ''
|
||||||
log: stdout
|
log: stdout
|
||||||
database: ./database.db
|
database: database.db
|
||||||
root: /srv
|
root: /srv
|
||||||
general:
|
general:
|
||||||
disable-thumbnails: false
|
disable-thumbnails: false
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
var GlobalConfiguration Settings
|
var GlobalConfiguration Settings
|
||||||
|
|
||||||
func Initialize() {
|
func init() {
|
||||||
// Open and read the YAML file
|
// Open and read the YAML file
|
||||||
yamlFile, err := os.Open("filebrowser.yml")
|
yamlFile, err := os.Open("filebrowser.yml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue