config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OnSave func(*Config)

Functions

func Init

func Init(filePath string) error

Init loads the config from disk into memory, creating it if it doesn't exist already.

func Reload

func Reload() error

func Save

func Save(conf *Config) error

func Set

func Set(c *Config) error

Types

type Config

type Config struct {
	Host              string `form:"host"`
	Port              int
	Password          []byte
	Salt              []byte
	Directory         string `form:"directory"`
	HashLen           int    `form:"id-size"`
	MaxAgeEnable      bool   `form:"enable-age-prune"`
	Age               int    `form:"max-age"` // max age of uploads in days
	MaxSizeEnable     bool   `form:"enable-size-prune"`
	Size              int64  `form:"max-size"`     // max total size of uploads in MB
	AppendExt         bool   `form:"append-ext"`   // append extensions to returned file URLs
	TwitterCardEnable bool   `form:"twitter-card"` // enable Twitter Card preview for embeddable files
	TwitterHandle     string `form:"twitter-handle"`
	SyntaxEnable      bool   `form:"syntax-enable"` // enable syntax highlighting for text files
	SyntaxTheme       string `form:"syntax-theme"`  // Chroma syntax highlight theme
}

Config is a global configuration for Airlift.

var (
	Default Config
)

func Get

func Get() *Config

func Load

func Load() (*Config, error)

func (Config) MaxAge

func (c Config) MaxAge() int

MaxAge satisfies the cache.Config interface.

func (Config) MaxCount

func (c Config) MaxCount() int

MaxCount satisfies the cache.Config interface.

func (Config) MaxSize

func (c Config) MaxSize() int64

MaxSize satisfies the cache.Config interface.

func (*Config) ProcessHash

func (c *Config) ProcessHash(buf []byte) string

func (*Config) Refresh

func (c *Config) Refresh()

Refresh satisfies the cache.Config interface.

func (Config) Secrets

func (c Config) Secrets() (pass, salt []byte, err error)

Secrets satisfies gas.User interface.

func (*Config) SetPass

func (c *Config) SetPass(pass string)

SetPass updates the config with the new password hash, generating a new random salt.

func (Config) Username

func (c Config) Username() string

Username satisfies the gas.User interface. It returns nothing, as Airlift doesn't use usernames.

Jump to

Keyboard shortcuts

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