mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-06-19 18:44:57 +00:00
Add backend is-secure configuration
This commit is contained in:
@@ -8,12 +8,18 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Backend contains backend connection-specific configuration
|
||||||
|
type Backend struct {
|
||||||
|
Addr string `mapstructure:"addr"`
|
||||||
|
Secured bool `mapstructure:"secured"`
|
||||||
|
}
|
||||||
|
|
||||||
// Content contains content-specific configuration
|
// Content contains content-specific configuration
|
||||||
type Content struct {
|
type Content struct {
|
||||||
Backend string `mapstructure:"backend"`
|
Backend Backend `mapstructure:"backend"`
|
||||||
Key string `mapstructure:"key"`
|
Key string `mapstructure:"key"`
|
||||||
Pinned string `mapstructure:"pinned"`
|
Pinned string `mapstructure:"pinned"`
|
||||||
PostsPerPage int `mapstructure:"postsPerPage"`
|
PostsPerPage int `mapstructure:"postsPerPage"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config contains application configuration
|
// Config contains application configuration
|
||||||
@@ -36,6 +42,8 @@ func init() {
|
|||||||
pflag.String("unix", "", "unix socket path to listen")
|
pflag.String("unix", "", "unix socket path to listen")
|
||||||
pflag.String("base", "", "http URI prefix")
|
pflag.String("base", "", "http URI prefix")
|
||||||
|
|
||||||
|
pflag.String("content.backend.addr", "demo.ghost.io:443", "ghost backend addr")
|
||||||
|
pflag.Bool("content.backend.secured", true, "is ghost backend secured")
|
||||||
pflag.String("content.backend", "demo.ghost.io:443", "ghost backend addr")
|
pflag.String("content.backend", "demo.ghost.io:443", "ghost backend addr")
|
||||||
pflag.String("content.key", "22444f78447824223cefc48062", "ghost content api key")
|
pflag.String("content.key", "22444f78447824223cefc48062", "ghost content api key")
|
||||||
pflag.String("content.pinned", "contact", "pinned page slug")
|
pflag.String("content.pinned", "contact", "pinned page slug")
|
||||||
|
|||||||
+2
-2
@@ -54,9 +54,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ghostClient := &ghost.HTTPClient{
|
ghostClient := &ghost.HTTPClient{
|
||||||
Addr: config.Content.Backend,
|
Addr: config.Content.Backend.Addr,
|
||||||
|
Secured: config.Content.Backend.Secured,
|
||||||
ContentKey: config.Content.Key,
|
ContentKey: config.Content.Key,
|
||||||
Secured: true,
|
|
||||||
QueryTimeout: time.Second,
|
QueryTimeout: time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user