feat: allow configuration through envvars (#504)
This commit is contained in:
parent
b1eb90767d
commit
cdd4bcdc65
@ -2,6 +2,14 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/asdine/storm"
|
"github.com/asdine/storm"
|
||||||
"github.com/filebrowser/filebrowser"
|
"github.com/filebrowser/filebrowser"
|
||||||
"github.com/filebrowser/filebrowser/bolt"
|
"github.com/filebrowser/filebrowser/bolt"
|
||||||
@ -10,14 +18,7 @@ import (
|
|||||||
"github.com/hacdias/fileutils"
|
"github.com/hacdias/fileutils"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"gopkg.in/natefinch/lumberjack.v2"
|
)
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings")
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
addr string
|
addr string
|
||||||
@ -117,6 +118,10 @@ func setupViper() {
|
|||||||
viper.BindPFlag("AlternativeRecaptcha", flag.Lookup("alternative-recaptcha"))
|
viper.BindPFlag("AlternativeRecaptcha", flag.Lookup("alternative-recaptcha"))
|
||||||
viper.BindPFlag("ReCaptchaKey", flag.Lookup("recaptcha-key"))
|
viper.BindPFlag("ReCaptchaKey", flag.Lookup("recaptcha-key"))
|
||||||
viper.BindPFlag("ReCaptchaSecret", flag.Lookup("recaptcha-secret"))
|
viper.BindPFlag("ReCaptchaSecret", flag.Lookup("recaptcha-secret"))
|
||||||
|
|
||||||
|
viper.SetEnvPrefix("FB")
|
||||||
|
viper.AutomaticEnv()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func printVersion() {
|
func printVersion() {
|
||||||
@ -155,7 +160,7 @@ func main() {
|
|||||||
printVersion()
|
printVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
initConfig();
|
initConfig()
|
||||||
|
|
||||||
// Set up process log before anything bad happens.
|
// Set up process log before anything bad happens.
|
||||||
switch viper.GetString("Logger") {
|
switch viper.GetString("Logger") {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user