path to refreshing states from email that doesnt work over vpn
This commit is contained in:
@@ -28,12 +28,16 @@ type Config struct {
|
||||
|
||||
var live Config
|
||||
|
||||
func Refresh() error {
|
||||
configPath, ok := os.LookupEnv("CONFIG")
|
||||
func configPath() string {
|
||||
p, ok := os.LookupEnv("CONFIG")
|
||||
if !ok {
|
||||
configPath = "./config.json"
|
||||
p = "./config.json"
|
||||
}
|
||||
b, err := ioutil.ReadFile(configPath)
|
||||
return p
|
||||
}
|
||||
|
||||
func Refresh() error {
|
||||
b, err := ioutil.ReadFile(configPath())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -52,6 +56,15 @@ func Get() *Config {
|
||||
return &live
|
||||
}
|
||||
|
||||
func Set(other Config) {
|
||||
b, err := json.Marshal(other)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ioutil.WriteFile(configPath(), b, os.ModePerm)
|
||||
Refresh()
|
||||
}
|
||||
|
||||
func (c *Config) DB() storage.DB {
|
||||
if c.db == nil {
|
||||
c.lock.Lock()
|
||||
|
||||
Reference in New Issue
Block a user