2015-07-29 07:01:23 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/Luzifer/rconfig"
|
|
|
|
)
|
|
|
|
|
|
|
|
type config struct {
|
|
|
|
// General Config
|
2017-12-24 18:44:24 +00:00
|
|
|
PasswordSalt string `env:"passwordSalt" flag:"password-salt" description:"[deprecated] A random unique salt for encrypting the passwords"`
|
2015-07-29 07:01:23 +00:00
|
|
|
UsernameSalt string `env:"usernameSalt" flag:"username-salt" description:"A random unique salt for encrypting the usernames"`
|
|
|
|
Storage string `env:"storage" flag:"storage" default:"local:///./data" description:"Configuration for storage adapter (see README.md)"`
|
2015-07-30 15:25:10 +00:00
|
|
|
Listen string `flag:"listen" env:"listen" default:":3000" description:"IP and port to listen on"`
|
2015-07-29 07:01:23 +00:00
|
|
|
|
2015-07-30 15:25:10 +00:00
|
|
|
CookieSigningKey string `flag:"cookie-authkey" env:"authkey" description:"Key used to authenticate the session"`
|
|
|
|
CookieEncryptKey string `flag:"cookie-encryptkey" env:"encryptkey" description:"Key used to encrypt the session"`
|
2015-07-29 07:49:23 +00:00
|
|
|
|
|
|
|
VersionAndQuit bool `flag:"version" default:"false" description:"Show version and quit"`
|
2015-07-29 07:01:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c config) ParsedStorage() (*url.URL, error) {
|
|
|
|
return url.Parse(c.Storage)
|
|
|
|
}
|
|
|
|
|
|
|
|
func loadConfig() *config {
|
|
|
|
cfg := &config{}
|
|
|
|
rconfig.Parse(cfg)
|
|
|
|
return cfg
|
|
|
|
}
|