config

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRestriction

func GetRestriction(w http.ResponseWriter, r *http.Request)

func LoadConfig

func LoadConfig(configPath string) error

LoadConfig init config package and export `config.Conf`

Types

type Config

type Config struct {
	Listen string      `yaml:"listen"`
	OIDC   []*OIDC     `yaml:"oidc"`
	State  StateConfig `yaml:"state"`
	Model  ModelConfig `yaml:"model"`
	Admins []string    `yaml:"admins"`
}
var (
	Conf *Config
)

type EtcdConfig

type EtcdConfig struct {
	Endpoints     []string `yaml:"endpoints"`
	CertFile      string   `yaml:"certFile,omitempty"`
	KeyFile       string   `yaml:"keyFile,omitempty"`
	TrustedCAFile string   `yaml:"trustedCAFile,omitempty"`
}

type ModelConfig

type ModelConfig struct {
	Status   StatusConfig `yaml:"status"`
	Keywords []string     `yaml:"keywords"`
}

type OIDC

type OIDC struct {
	Provider     string   `yaml:"provider"`
	Issuer       string   `yaml:"issuer"`
	AuthURL      string   `yaml:"authURL"`
	TokenURL     string   `yaml:"tokenURL"`
	UserInfoURL  string   `yaml:"userInfoURL"`
	ClientID     string   `yaml:"clientID"`
	ClientSecret string   `yaml:"clientSecret"`
	Redirect     string   `yaml:"redirect"`
	Scopes       []string `yaml:"scopes"`
	TrustEmail   bool     `yaml:"trustEmail"`
	UserMeta     UserMeta `yaml:"userMeta"`
}

type OIDCProvider

type OIDCProvider struct {
	Provider   *oidc.Provider
	Config     *oauth2.Config
	TrustEmail bool
	UserMeta   *UserMeta
}

func GetOIDCProvider

func GetOIDCProvider(provider string) *OIDCProvider

type Restriction

type Restriction struct {
	Status StatusConfig `json:"status"`
}

type StateConfig

type StateConfig struct {
	Etcd *EtcdConfig `yaml:"etcd"`
}

type StatusConfig

type StatusConfig struct {
	ContentListLimit int `yaml:"contentListLimit" json:"contentListLimit"`
	ContentLimit     int `yaml:"contentLimit" json:"contentLimit"`
	OverviewLimit    int `yaml:"overviewLimit" json:"overviewLimit"`
}

func (*StatusConfig) RestrictContent

func (c *StatusConfig) RestrictContent(content string) error

func (*StatusConfig) RestrictContentList

func (c *StatusConfig) RestrictContentList(contentListSize int) error

func (*StatusConfig) RestrictOverview

func (c *StatusConfig) RestrictOverview(content string) error

type UserMeta

type UserMeta struct {
	Email   string `yaml:"email"`
	Name    string `yaml:"name"`
	Picture string `yaml:"picture"`
	Bio     string `yaml:"bio"`
	Locale  string `yaml:"locale"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL