config

package
v0.0.0-...-23be0e1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigPath = "config.json"

Functions

This section is empty.

Types

type Backblaze

type Backblaze struct {
	KeyID      string `json:"key_id"`
	KeySecret  string `json:"key_secret"`
	BucketName string `json:"bucket_name"`
	Endpoint   string `json:"endpoint"`
}

func (*Backblaze) Default

func (r *Backblaze) Default() error

func (*Backblaze) Update

func (r *Backblaze) Update(form url.Values) error

func (*Backblaze) Validate

func (r *Backblaze) Validate() error

type Cloudflare

type Cloudflare struct {
	CaptchaKey    string `json:"captcha_key"`
	CaptchaSecret string `json:"captcha_secret"`
}

func (*Cloudflare) Default

func (c *Cloudflare) Default() error

func (*Cloudflare) Enable

func (c *Cloudflare) Enable() bool

func (*Cloudflare) Update

func (c *Cloudflare) Update(form url.Values) error

func (*Cloudflare) Validate

func (c *Cloudflare) Validate() error

func (*Cloudflare) Verify

func (c *Cloudflare) Verify(token string) bool

type Config

type Config struct {
	Database         string     `json:"db"`
	Cloudflare       Cloudflare `json:"cf"`
	Backblaze        Backblaze  `json:"b2"`
	AllowNewAccounts bool       `json:"allow_new_accounts"`
}

Config for this project

func Parse

func Parse(b []byte, path string) (*Config, error)

Parse config from json byte

func Read

func Read(path string) (*Config, error)

Read the config from `path`

func (*Config) Default

func (c *Config) Default() error

Default config

func (*Config) Save

func (c *Config) Save(path string) error

func (*Config) Update

func (c *Config) Update(form url.Values) error

Update the config from config form

func (*Config) Validate

func (c *Config) Validate() error

Jump to

Keyboard shortcuts

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