updated
This commit is contained in:
parent
1cd055d768
commit
91f4a299c4
|
@ -45,9 +45,7 @@ func init() {
|
|||
cobra.OnInitialize(initConfig)
|
||||
cobra.MousetrapHelpText = ""
|
||||
rootCmd.SetVersionTemplate("File Browser version {{printf \"%s\" .Version}}\n")
|
||||
settings.Initialize()
|
||||
|
||||
log.Println(settings.GlobalConfiguration)
|
||||
flags := rootCmd.Flags()
|
||||
|
||||
persistent := rootCmd.PersistentFlags()
|
||||
|
@ -88,12 +86,12 @@ 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) {
|
||||
serverConfig := settings.GlobalConfiguration.Server
|
||||
|
||||
if !d.hadDB {
|
||||
quickSetup(cmd.Flags(), d)
|
||||
}
|
||||
|
||||
workersCount := serverConfig.NumImageProcessors
|
||||
log.Println(serverConfig)
|
||||
if workersCount < 1 {
|
||||
log.Fatal("Image resize workers count could not be < 1")
|
||||
}
|
||||
|
|
|
@ -85,7 +85,8 @@ 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 := settings.GlobalConfiguration.Server.Database
|
||||
|
||||
path := getParam(cmd.Flags(), "database")
|
||||
exists, err := dbExists(path)
|
||||
|
||||
if err != nil {
|
||||
|
@ -99,7 +100,6 @@ 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)
|
||||
|
|
|
@ -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 {
|
||||
|
@ -42,6 +42,7 @@ func setDefaults() {
|
|||
BaseURL: "/files",
|
||||
},
|
||||
Auth: Auth{
|
||||
Method: "password",
|
||||
Recaptcha: Recaptcha{
|
||||
Host: "",
|
||||
},
|
||||
|
|
|
@ -52,8 +52,8 @@ type Recaptcha struct {
|
|||
}
|
||||
|
||||
type Server struct {
|
||||
IndexingInterval uint32
|
||||
NumImageProcessors int
|
||||
IndexingInterval uint32 `json:"indexingInterval"`
|
||||
NumImageProcessors int `json:"numImageProcessors"`
|
||||
Socket string `json:"socket"`
|
||||
TLSKey string `json:"tlsKey"`
|
||||
TLSCert string `json:"tlsCert"`
|
||||
|
|
Loading…
Reference in New Issue