mirror of https://github.com/zhufuyi/sponge
refactor: rename Path function to Location for clarity in config file handling
This commit is contained in:
parent
613c6282f5
commit
0447d292ea
|
@ -92,7 +92,7 @@ func initConfig() {
|
|||
// get configuration from local configuration file
|
||||
func getConfigFromLocal() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample.yml")
|
||||
configFile = configs.Location("serverNameExample.yml")
|
||||
}
|
||||
err := config.Init(configFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -88,7 +88,7 @@ func initConfig() {
|
|||
// get configuration from local configuration file
|
||||
func getConfigFromLocal() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample.yml")
|
||||
configFile = configs.Location("serverNameExample.yml")
|
||||
}
|
||||
err := config.Init(configFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -92,7 +92,7 @@ func initConfig() {
|
|||
// get configuration from local configuration file
|
||||
func getConfigFromLocal() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample.yml")
|
||||
configFile = configs.Location("serverNameExample.yml")
|
||||
}
|
||||
err := config.Init(configFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -92,7 +92,7 @@ func initConfig() {
|
|||
// get configuration from local configuration file
|
||||
func getConfigFromLocal() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample.yml")
|
||||
configFile = configs.Location("serverNameExample.yml")
|
||||
}
|
||||
err := config.Init(configFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -92,7 +92,7 @@ func initConfig() {
|
|||
// get configuration from local configuration file
|
||||
func getConfigFromLocal() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample.yml")
|
||||
configFile = configs.Location("serverNameExample.yml")
|
||||
}
|
||||
err := config.Init(configFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -92,7 +92,7 @@ func initConfig() {
|
|||
// get configuration from local configuration file
|
||||
func getConfigFromLocal() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample.yml")
|
||||
configFile = configs.Location("serverNameExample.yml")
|
||||
}
|
||||
err := config.Init(configFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -104,7 +104,7 @@ func initConfig() {
|
|||
// then read the service configuration according to the nacos configuration center)
|
||||
func getConfigFromNacos() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample_cc.yml")
|
||||
configFile = configs.Location("serverNameExample_cc.yml")
|
||||
}
|
||||
nacosConfig, err := config.NewCenter(configFile)
|
||||
if err != nil {
|
||||
|
@ -130,7 +130,7 @@ func getConfigFromNacos() {
|
|||
// get configuration from local configuration file
|
||||
func getConfigFromLocal() {
|
||||
if configFile == "" {
|
||||
configFile = configs.Path("serverNameExample.yml")
|
||||
configFile = configs.Location("serverNameExample.yml")
|
||||
}
|
||||
err := config.Init(configFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -13,8 +13,8 @@ func init() {
|
|||
basePath = filepath.Dir(currentFile)
|
||||
}
|
||||
|
||||
// Path return absolute path
|
||||
func Path(rel string) string {
|
||||
// return absolute path of sponge configs yml file
|
||||
func Location(rel string) string {
|
||||
if filepath.IsAbs(rel) {
|
||||
return rel
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue