65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"io/ioutil"
|
|
|
|
"github.com/kr/pretty"
|
|
"github.com/philandstuff/dhall-golang"
|
|
)
|
|
|
|
type Config struct {
|
|
Discord struct {
|
|
Webhook string `json:"Webhook"`
|
|
} `json:"Discord"`
|
|
Gitea struct {
|
|
Instance string `json:"Instance"`
|
|
Token string `json:"Token"`
|
|
} `json:"Gitea"`
|
|
Github struct {
|
|
Token string `json:"Token"`
|
|
} `json:"Github"`
|
|
Mastodon struct {
|
|
Account string `json:"Account"`
|
|
AppID string `json:"AppID"`
|
|
AppSecret string `json:"AppSecret"`
|
|
Instance string `json:"Instance"`
|
|
Token string `json:"Token"`
|
|
} `json:"Mastodon"`
|
|
Paseto struct {
|
|
Private string `json:"Private"`
|
|
Public string `json:"Public"`
|
|
} `json:"Paseto"`
|
|
Patreon struct {
|
|
AccessToken string `json:"AccessToken"`
|
|
ClientID string `json:"ClientID"`
|
|
ClientSecret string `json:"ClientSecret"`
|
|
RefreshToken string `json:"RefreshToken"`
|
|
} `json:"Patreon"`
|
|
Reddit struct {
|
|
AppID string `json:"AppID"`
|
|
AppSecret string `json:"AppSecret"`
|
|
Password string `json:"Password"`
|
|
Username string `json:"Username"`
|
|
} `json:"Reddit"`
|
|
RethinkDBURL string `json:"RethinkDBURL"`
|
|
Twitter struct {
|
|
APIKey string `json:"ApiKey"`
|
|
APISecret string `json:"ApiSecret"`
|
|
ConsumerSecret string `json:"ConsumerSecret"`
|
|
ConsumerToken string `json:"ConsumerToken"`
|
|
} `json:"Twitter"`
|
|
}
|
|
|
|
func main() {
|
|
var cfg Config
|
|
data, err := ioutil.ReadFile("mi.dhall")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
err = dhall.Unmarshal([]byte(data), &cfg)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
pretty.Println(cfg)
|
|
}
|