Migrated to using viper's ConfigFileUsed().

This commit is contained in:
Patrick Connolly
2018-11-08 06:28:23 +08:00
parent 4ddb3bafe0
commit 6880d0f188
3 changed files with 5 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ func (b *Api) handleConfigReload(c echo.Context) error {
b.Log.Error("Error reading remote config file: ", err)
return c.String(http.StatusInternalServerError, "Internal Server Error")
}
cfgfile := b.GetConfigFile()
cfgfile := b.ConfigFileUsed()
err = ioutil.WriteFile(cfgfile, content, 0644)
if err != nil {
b.Log.Error("Failed to write remote config file: ", err)

View File

@@ -68,8 +68,8 @@ func (b *Bridge) joinChannels(channels map[string]config.ChannelInfo, exists map
return nil
}
func (b *Bridge) GetConfigFile() string {
return b.Config.GetConfigFile()
func (b *Bridge) ConfigFileUsed() string {
return b.Config.ConfigFileUsed()
}
func (b *Bridge) GetBool(key string) bool {

View File

@@ -173,7 +173,6 @@ type ConfigValues struct {
General Protocol
Gateway []Gateway
SameChannelGateway []SameChannelGateway
ConfigFile string
}
type Config struct {
@@ -234,8 +233,8 @@ func NewConfigFromString(input []byte) *Config {
return mycfg
}
func (c *Config) GetConfigFile() string {
return c.v.GetString("ConfigFile")
func (c *Config) ConfigFileUsed() string {
return c.v.ConfigFileUsed()
}
func (c *Config) GetBool(key string) bool {