feat: add config
This commit is contained in:
parent
b25892c226
commit
7fba76a935
1 changed files with 31 additions and 0 deletions
31
config.go
Normal file
31
config.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue