From d0870083f7ff256dfca3c0123cc9ce3478062c21 Mon Sep 17 00:00:00 2001 From: pb Date: Tue, 31 Oct 2023 10:30:01 +0100 Subject: [PATCH] Changed the conf object to the conf package for better accessibility --- conf/conf.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 conf/conf.go diff --git a/conf/conf.go b/conf/conf.go new file mode 100644 index 0000000..5a2c351 --- /dev/null +++ b/conf/conf.go @@ -0,0 +1,19 @@ +package conf + +import "sync" + +type Config struct { + MongoURL string + DCNAME string + DBPOINT string +} + +var instance *Config +var once sync.Once + +func GetConfig() *Config { + once.Do(func() { + instance = &Config{} + }) + return instance +}