Merge pull request #116 from Eric-Guo/main

refactor: rename Path function to Location for clarity in config file handling
This commit is contained in:
zhuyasen 2025-07-28 21:26:02 +08:00 committed by GitHub
commit 4d5335d4c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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
}