refactor: rename Path function to Location for clarity in config file handling

This commit is contained in:
Eric-Guo 2025-07-28 15:14:47 +08:00
parent 613c6282f5
commit 0447d292ea
8 changed files with 10 additions and 10 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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
}