diff --git a/config.go b/config.go index 0b77063..10d9e76 100644 --- a/config.go +++ b/config.go @@ -25,54 +25,54 @@ func NewConfig(name string) (*Config, error) { return c, nil } -// GetKeyList at the config level returns all keys in the .toml file +// GetKeyList at the config level returns all keys in the .conf file func (c *Config) GetKeyList() []string { return c.generalConfig.GetKeyList() } -// Set at the config level sets a value in the .toml file +// Set at the config level sets a value in the .conf file func (c *Config) Set(k, v string) error { return c.generalConfig.Set(k, v) } -// SetBytes at the config level sets a value in the .toml file +// SetBytes at the config level sets a value in the .conf file func (c *Config) SetBytes(k string, v []byte) error { return c.generalConfig.SetBytes(k, v) } -// SetInt saves an integer (as a string) in the .toml file +// SetInt saves an integer (as a string) in the .conf file func (c *Config) SetInt(k string, v int) error { return c.generalConfig.SetInt(k, v) } -// SetDateTime saves a time.Time (as a string) in the .toml file +// SetDateTime saves a time.Time (as a string) in the .conf file func (c *Config) SetDateTime(k string, v time.Time) error { return c.generalConfig.SetDateTime(k, v) } -// SetArray saves a string slice in the .toml file +// SetArray saves a string slice in the .conf file func (c *Config) SetArray(k string, v []string) error { return c.generalConfig.SetArray(k, v) } -// Get at the config level retrieves a value from the .toml file +// Get at the config level retrieves a value from the .conf file func (c *Config) Get(k string) string { return c.generalConfig.Get(k) } -// GetBytes at the config level retrieves a value from the .toml file +// GetBytes at the config level retrieves a value from the .conf file // and returns it as a byte slice func (c *Config) GetBytes(k string) []byte { return c.generalConfig.GetBytes(k) } -// GetInt at the config level retrieves a value from the .toml file +// GetInt at the config level retrieves a value from the .conf file // and returns it as an integer (or an error if conversion fails) func (c *Config) GetInt(k string) (int, error) { return c.generalConfig.GetInt(k) } -// GetDateTime at the config level retrieves a value from the .toml file +// GetDateTime at the config level retrieves a value from the .conf file func (c *Config) GetDateTime(k string) (time.Time, error) { return c.generalConfig.GetDateTime(k) } @@ -81,7 +81,7 @@ func (c *Config) GetArray(k string) ([]string, error) { return c.generalConfig.GetArray(k) } -// DeleteKey at the config level removes a key from the .toml file +// DeleteKey at the config level removes a key from the .conf file func (c *Config) DeleteKey(k string) error { return c.generalConfig.DeleteKey(k) } diff --git a/config_file.go b/config_file.go index 4852d9a..84bd81b 100644 --- a/config_file.go +++ b/config_file.go @@ -43,8 +43,8 @@ func (gf *GeneralConfig) Load() error { return errors.New("Invalid ConfigFile Name: " + gf.Path + string(os.PathSeparator) + gf.Name) } - // Config files end with .toml - cfgPath := gf.Path + string(os.PathSeparator) + gf.Name + ".toml" + // Config files end with .conf + cfgPath := gf.Path + string(os.PathSeparator) + gf.Name + ".conf" tomlData, err := ioutil.ReadFile(cfgPath) if err != nil { // Couldn't find the file, save a new one @@ -61,7 +61,7 @@ func (gf *GeneralConfig) Load() error { // Save writes the config to file(s) func (gf *GeneralConfig) Save() error { buf := new(bytes.Buffer) - cfgPath := gf.Path + string(os.PathSeparator) + gf.Name + ".toml" + cfgPath := gf.Path + string(os.PathSeparator) + gf.Name + ".conf" if err := toml.NewEncoder(buf).Encode(gf); err != nil { return err } @@ -89,7 +89,7 @@ func (gf *GeneralConfig) Set(k, v string) error { return nil } -// SetBytes at the config level sets a value in the .toml file +// SetBytes at the config level sets a value in the .conf file func (gf *GeneralConfig) SetBytes(k string, v []byte) error { return gf.Set(k, string(v)) }