29 lines
442 B
Go
29 lines
442 B
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"github.com/BurntSushi/toml"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
type Config struct {
|
||
|
Username string
|
||
|
Password string
|
||
|
ProxyAddr string
|
||
|
Channels []string
|
||
|
Filter []uint8
|
||
|
Webhook string
|
||
|
DbPath string
|
||
|
CookiePath string
|
||
|
}
|
||
|
|
||
|
func ConfigFromFile(filePath string) (conf *Config, err error) {
|
||
|
tomlData, err := os.ReadFile(filePath)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
_, err = toml.Decode(string(tomlData), &conf)
|
||
|
|
||
|
return
|
||
|
}
|