security inject appName
This commit is contained in:
@@ -23,12 +23,11 @@ import (
|
|||||||
* The configuration loader will give priority to the local file over the default file
|
* The configuration loader will give priority to the local file over the default file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func GetConfLoader() *onion.Onion {
|
func GetConfLoader(appName string) *onion.Onion {
|
||||||
logger := zerolog.New(os.Stdout).With().Timestamp().Logger()
|
logger := zerolog.New(os.Stdout).With().Timestamp().Logger()
|
||||||
AppName := GetAppName()
|
|
||||||
EnvPrefix := "OC_"
|
EnvPrefix := "OC_"
|
||||||
defaultConfigFile := "/etc/oc/" + AppName[3:] + ".json"
|
defaultConfigFile := "/etc/oc/" + appName[3:] + ".json"
|
||||||
localConfigFile := "./" + AppName[3:] + ".json"
|
localConfigFile := "./" + appName[3:] + ".json"
|
||||||
var configFile string
|
var configFile string
|
||||||
var o *onion.Onion
|
var o *onion.Onion
|
||||||
l3 := GetEnvVarLayer(EnvPrefix)
|
l3 := GetEnvVarLayer(EnvPrefix)
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ func InitDaemon(appName string) {
|
|||||||
// create a temporary console logger for init
|
// create a temporary console logger for init
|
||||||
logs.SetLogger(logs.CreateLogger("main"))
|
logs.SetLogger(logs.CreateLogger("main"))
|
||||||
// Load the right config file
|
// Load the right config file
|
||||||
o := GetConfLoader()
|
o := GetConfLoader(appName)
|
||||||
// resources.InitNative()
|
// resources.InitNative()
|
||||||
// feed the library with the loaded config
|
// feed the library with the loaded config
|
||||||
SetConfig(
|
SetConfig(
|
||||||
@@ -272,8 +272,8 @@ func GetConfig() *config.Config {
|
|||||||
* The configuration loader will give priority to the local file over the default file
|
* The configuration loader will give priority to the local file over the default file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func GetConfLoader() *onion.Onion {
|
func GetConfLoader(appName string) *onion.Onion {
|
||||||
return config.GetConfLoader()
|
return config.GetConfLoader(appName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Request struct {
|
type Request struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user