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