1
0
Fork 0
mirror of https://github.com/MedzikUser/go-cdn synced 2024-08-15 03:19:36 +00:00
go-cdn/config/yml.go
Medzik 87c7dc4f8f Added YML config and More
- Discord Bot: Added YML config and moved bot settings from DB to this file
- Error logs names has been renames
- Discord Bot: Added upload from multi attachments
- Update README, Makefile, go.mod and .gitignore
2021-07-15 14:33:17 +02:00

36 lines
588 B
Go

package config
import (
"io/ioutil"
"gitlab.com/gaming0skar123/go/cdn/common"
"gopkg.in/yaml.v2"
)
type YmlConfig struct {
Discord YmlConfigDiscord
}
type YmlConfigDiscord struct {
API_Channel string
Channels []string
}
var API_Channel string
var Channels []string
func init() {
f, err := ioutil.ReadFile("config.yml")
if common.CheckErr(err, "read config file") {
return
}
var data YmlConfig
err = yaml.Unmarshal(f, &data)
if common.CheckErr(err, "unmarshal config file") {
return
}
API_Channel = data.Discord.API_Channel
Channels = data.Discord.Channels
}