feat: add config

This commit is contained in:
Siwoo Jeon 2024-08-17 16:53:59 +09:00
parent b25892c226
commit 7fba76a935
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA

31
config.go Normal file
View file

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