✨ Add remaining configs with defaults
This commit is contained in:
parent
996f59c8af
commit
072031f86c
1 changed files with 53 additions and 11 deletions
|
|
@ -6,6 +6,21 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ProfileMetadata struct {
|
||||||
|
Key string `toml:"key"`
|
||||||
|
Value string `toml:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BlockedServer struct {
|
||||||
|
Hostname string `toml:"hostname"`
|
||||||
|
Reason string `toml:"reason"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PrivacyReplace struct {
|
||||||
|
Domain string `toml:"domain"`
|
||||||
|
ReplaceBy string `toml:"replace_by"`
|
||||||
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Domain string `toml:"domain"`
|
Domain string `toml:"domain"`
|
||||||
Username string `toml:"username"`
|
Username string `toml:"username"`
|
||||||
|
|
@ -15,14 +30,41 @@ type Config struct {
|
||||||
Https bool `toml:"https"`
|
Https bool `toml:"https"`
|
||||||
IconUrl string `toml:"icon_url""`
|
IconUrl string `toml:"icon_url""`
|
||||||
ImageUrl string `toml:"image_url"`
|
ImageUrl string `toml:"image_url"`
|
||||||
|
Metadata []ProfileMetadata `toml:"metadata"`
|
||||||
Secret string `toml:"secret"`
|
Secret string `toml:"secret"`
|
||||||
TrustedHosts []string `toml:"trusted_hosts"`
|
TrustedHosts []string `toml:"trusted_hosts"`
|
||||||
ManuallyApproveFollers bool `toml:"manually_approves_followers"`
|
ManuallyApprove bool `toml:"manually_approves_followers"`
|
||||||
|
BlockedServers []BlockedServer `toml:"blocked_servers"`
|
||||||
|
CustomFooter string `toml:"custom_footer"`
|
||||||
|
Emoji string `toml:"emoji"`
|
||||||
|
DisabledNotificaions []string `toml:"disabled_notifications"`
|
||||||
|
CodeTheme string `toml:"code_highlighting_theme"`
|
||||||
|
AlsoKnownAs string `toml:"also_known_as"`
|
||||||
|
HideFollowers bool `toml:"hides_followers"`
|
||||||
|
HideFollowing bool `toml:"hides_following"`
|
||||||
|
InboxRetentionDays int `toml:"inbox_retention_days"`
|
||||||
|
CustomCSP string `toml:"custom_content_security_policy"`
|
||||||
|
WebfingerDomain string `toml:"webfinger_domain"`
|
||||||
|
Debug bool `toml:"debug"`
|
||||||
|
PrivacyReplace []PrivacyReplace `toml:"privacy_replace"`
|
||||||
|
KeyPath string `toml:"key_path"`
|
||||||
|
SessionTimeout int `toml:"session_timeout"`
|
||||||
|
Id string `toml:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var config Config
|
var config Config
|
||||||
|
|
||||||
|
func newConfig() Config {
|
||||||
|
return Config{
|
||||||
|
TrustedHosts: []string{"127.0.0.1"},
|
||||||
|
CodeTheme: "friendly_grayscale",
|
||||||
|
InboxRetentionDays: 15,
|
||||||
|
SessionTimeout: 3600 * 24 * 3,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
config = newConfig()
|
||||||
configPath := configdir.LocalConfig("gopub")
|
configPath := configdir.LocalConfig("gopub")
|
||||||
if err := configdir.MakePath(configPath); err != nil {
|
if err := configdir.MakePath(configPath); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
||||||
Reference in a new issue