-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4e26be
commit 348f69f
Showing
14 changed files
with
185 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/spf13/viper" | ||
) | ||
|
||
const ( | ||
defaultConfigFileName = "rotom.toml" | ||
) | ||
|
||
func initConfig(fileName string) error { | ||
viper.SetConfigFile(fileName) | ||
return viper.ReadInConfig() | ||
} | ||
|
||
func configGet(key string) any { return viper.Get(key) } | ||
|
||
func configGetString(key string) string { return viper.GetString(key) } | ||
|
||
func configGetInt(key string) int { return viper.GetInt(key) } | ||
|
||
func configGetBool(key string) bool { return viper.GetBool(key) } | ||
|
||
func configGetPort() int { | ||
return configGetInt("tcp.port") | ||
} | ||
|
||
func configGetAppendOnly() bool { | ||
return configGetBool("aof.appendonly") | ||
} | ||
|
||
func configGetAppendFileName() string { | ||
return configGetString("aof.appendfilename") | ||
} | ||
|
||
func configGetDbFileName() string { | ||
return configGetString("rdb.dbfilename") | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.