cfg

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright © 2023 Thomas von Dein

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const Version string = "v0.0.3"

Variables

View Source
var VERSION string // maintained by -x

Functions

func Getversion

func Getversion() string

Types

type Apicontext

type Apicontext struct {
	Context string `koanf:"context"` // aka name or tenant
	Key     string `koanf:"key"`
}

type Config

type Config struct {
	// Flags+config file settings
	ApiPrefix  string `koanf:"apiprefix"` // path prefix
	Debug      bool   `koanf:"debug"`
	Listen     string `koanf:"listen"`     // [host]:port
	StorageDir string `koanf:"storagedir"` // db and uploads go there
	Url        string `koanf:"url"`        // public visible url, might be different from Listen
	DbFile     string `koanf:"dbfile"`
	Super      string `koanf:"super"`     // the apicontext which has all permissions
	Frontpage  string `koanf:"frontpage"` // a html file
	Formpage   string `koanf:"formpage"`  // a html file

	// fiber settings, see:
	// https://docs.gofiber.io/api/fiber/#config
	Prefork   bool   `koanf:"prefork"`   // default: nope
	AppName   string `koanf:"appname"`   // "upd"
	BodyLimit int    `koanf:"bodylimit"` // much
	V4only    bool   `koanf:"ipv4"`
	V6only    bool   `koanf:"ipv6"`
	Network   string

	// only settable via config
	Apicontexts []Apicontext `koanf:"apicontexts"`

	// smtp settings
	Mail Mailsettings `koanf:"mail"`

	// Internals only
	RegNormalizedFilename *regexp.Regexp
	RegDuration           *regexp.Regexp
	RegKey                *regexp.Regexp
	RegEmail              *regexp.Regexp
	RegText               *regexp.Regexp
	RegQuery              *regexp.Regexp

	CleanInterval time.Duration
	DefaultExpire int
}

holds the whole configs, filled by commandline flags, env and config file

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

post processing of options, if any

func (*Config) GetVersion

func (c *Config) GetVersion() string

type Mailsettings

type Mailsettings struct {
	Server   string `koanf:"server"`
	Port     string `koanf:"port"`
	From     string `koanf:"from"`
	Password string `koanf:"password"`
}

Jump to

Keyboard shortcuts

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