diff --git a/config.go b/config.go new file mode 100644 index 0000000..4e02186 --- /dev/null +++ b/config.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "log" + "os" + + "github.com/joho/godotenv" +) + +type Config struct { + token string +} + +// LoadConfig a config +func LoadConfig() *Config { + err := godotenv.Load() + if err != nil { + fmt.Println("[goMuffin] 봇의 설절파일을 불러올 수가 없어요.") + log.Fatalln(err) + } + config := Config{} + setConfig(&config) + + return &config +} + +func setConfig(config *Config) { + token := os.Getenv("TOKEN") + config.token = token +}