config

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestName     = "Jane Done"
	TestEmail    = "jane@example.com"
	TestPassword = "1234"
)

Variables

View Source
var ErrInvalidAlertPath = errors.New("invalid alert path : use filename[name,interval] format")

Functions

func ConfigCMD

func ConfigCMD() *cli.Command

func GetAgeSecret

func GetAgeSecret(ctx context.Context) *age.X25519Identity

func GetSecuritySecret

func GetSecuritySecret(ctx context.Context) ed25519.PrivateKey

func Load

func Load(base *Options) (context.Context, error)

func ParseAlert added in v0.0.15

func ParseAlert(txt string) (name, path string, interval time.Duration, err error)

FromText parses alert from txt.

Types

type Options

type Options struct {
	Listen string
	URL    string
	Mailer struct {
		Enabled       bool
		Name, Address string
		SMTP          struct {
			Address       string
			AuthAnonymous struct {
				Enabled bool
				Trace   string
			}

			AuthOAUTHBearer struct {
				Enabled               bool
				Username, Token, Host string
				Port                  int
			}
			AuthPlain struct {
				Enabled                      bool
				Identity, Username, Password string
			}
			EnableMailHog bool
		}
	}
	DataPath string
	LogLevel string
	Secrets  struct {
		Age, Secret string
	}
	Uploads struct {
		Dir string
	}
	Cors struct {
		Origin                string
		Credentials           bool
		MaxAge                int
		Headers               []string
		Expose                []string
		Methods               []string
		SendPreflightResponse bool
	}
	SuperUsers []string
	Firewall   struct {
		Enabled bool
		BlockIP []string
		AllowIP []string
	}
	Intervals struct {
		SiteCache, TSSync, GC, Merge, System time.Duration
	}
	Backup struct {
		Enabled bool
		Dir     string
	}
	Acme struct {
		Enabled         bool
		Domain          string
		CertsPath       string
		Issuer          certmagic.ACMEIssuer
		ExternalAccount acme.EAB
	}
	TLS struct {
		Enabled            bool
		Address, Key, Cert string
	}
	Bootstrap struct {
		Enabled                              bool
		Name, FullName, Email, Password, Key string
	}
	Alerts struct {
		Enabled bool
		Sources []string
	}
	EnableProfile bool
	// If true don't listen on os.Interrupt signal.
	NoSignal bool
}

func Get

func Get(ctx context.Context) *Options

func Test added in v0.0.10

func Test(fn ...func(*Options)) *Options

Test returns Options with initialized values. This rely only on env Variables for flags.

func (*Options) Flags

func (o *Options) Flags() []cli.Flag

func (*Options) IsSuperUser

func (o *Options) IsSuperUser(uid string) bool

func (*Options) Magic added in v0.0.11

func (o *Options) Magic() *certmagic.Config

Jump to

Keyboard shortcuts

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