diff --git a/config.example.yaml b/config.example.yaml index 42709df8..b2ef7f8b 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -19,8 +19,6 @@ tokensSecret: SecureSecret webhookSecret: GitHub # The website language. language: en -# The website title. -title: "The Website Title" # Turn on TOR Onion service (with Onion-Location header). tor: true @@ -31,11 +29,6 @@ login: # Encrypted password. Use 'eagle pwd' to generate the password. password: invalidSecret -# Webmentions configuration. -webmentions: - # Webmention.io (https://webmention.io) secret for incoming webmentions. - secret: MySecret - # Enable support for comments. They are moderated through the same view as # Webmentions, and stored in the same file. You need to add a form to your posts # to submit a comment to the '/comments' endpoint. @@ -43,6 +36,11 @@ comments: # Must be set to enable. Page to which to redirect users after commenting. redirect: /my-thank-you-page/ +# Webmentions configuration. +webmentions: + # Webmention.io (https://webmention.io) secret for incoming webmentions. + secret: MySecret + # Optional Micropub configuration. Disabled otherwise. micropub: # Which of your Hugo taxonomy is Micropub channels. Disabled if not set. diff --git a/core/config.go b/core/config.go index fe541828..d3dfa546 100644 --- a/core/config.go +++ b/core/config.go @@ -5,6 +5,7 @@ import ( "fmt" "net/url" "path/filepath" + "strings" "github.com/spf13/viper" "go.hacdias.com/indielib/micropub" @@ -48,11 +49,11 @@ type ServerConfig struct { Comments Comments Webmentions Webmentions Micropub *Micropub - Plugins map[string]map[string]interface{} - MeiliSearch *MeiliSearch Notifications Notifications BunnyCDN *BunnyCDN + MeiliSearch *MeiliSearch ImgProxy *ImgProxy + Plugins map[string]map[string]interface{} } func parseServerConfig() (*ServerConfig, error) { @@ -60,6 +61,10 @@ func parseServerConfig() (*ServerConfig, error) { v.SetConfigName("config") v.AddConfigPath(".") + v.SetEnvPrefix("eagle") + v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) + v.AutomaticEnv() + err := v.ReadInConfig() if err != nil { return nil, err @@ -154,14 +159,14 @@ func (u *Login) validate() error { return nil } -type Webmentions struct { - Secret string -} - type Comments struct { Redirect string } +type Webmentions struct { + Secret string +} + type Micropub struct { ChannelsTaxonomy string CategoriesTaxonomy string