mirror of
https://github.com/MedzikUser/go-cdn
synced 2024-08-15 03:19:36 +00:00
- 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
36 lines
588 B
Go
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
|
|
}
|