environment

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPort = 53842

DefaultPort for the webserver

Variables

View Source
var BuildTime = "Dev Build"

BuildTime is the time of the build (auto-generated value)

View Source
var Builder = "Manual Build"

Builder is the name of builder (auto-generated value)

View Source
var IsDocker = "false"

IsDocker has to be true if compiled for the Docker image (auto-generated value)

Functions

func GetConfigPaths

func GetConfigPaths() (string, string, string, string)

GetConfigPaths returns the config paths to config files and the directory containing the files. The following results are returned: Path to config file, Path to directory containing config file, Name of config file, Path to AWS config file

func IsDockerInstance

func IsDockerInstance() bool

IsDockerInstance returns true if the binary was compiled with the official docker makefile, which sets IsDocker to true

Types

type Environment

type Environment struct {
	ConfigDir        string `env:"CONFIG_DIR" envDefault:"config"`
	ConfigFile       string `env:"CONFIG_FILE" envDefault:"config.json"`
	ConfigPath       string
	DataDir          string `env:"DATA_DIR" envDefault:"data"`
	WebserverPort    int    `env:"PORT" envDefault:"53842"`
	LengthId         int    `env:"LENGTH_ID" envDefault:"15"`
	MaxMemory        int    `env:"MAX_MEMORY_UPLOAD" envDefault:"40"`
	MaxFileSize      int    `env:"MAX_FILESIZE" envDefault:"102400"` // 102400==100GB
	AwsBucket        string `env:"AWS_BUCKET"`
	AwsRegion        string `env:"AWS_REGION"`
	AwsKeyId         string `env:"AWS_KEY"`
	AwsKeySecret     string `env:"AWS_KEY_SECRET"`
	AwsEndpoint      string `env:"AWS_ENDPOINT"`
	DatabaseName     string `env:"DB_NAME" envDefault:"gokapi.sqlite"`
	DisableCorsCheck bool   `env:"DISABLE_CORS_CHECK" envDefault:"false"`
	// Deprecated: will be removed with 1.9
	LegacyDbPath string
	// Deprecated: will be removed with 1.9
	// Previously undocumented env "FILE_DB"
	LegacyDbFolderName string `env:"LEGACY_FILE_DB" envDefault:"filestorage.db"`
}

Environment is a struct containing available env variables

func New

func New() Environment

New parses the env variables

func (*Environment) IsAwsProvided

func (e *Environment) IsAwsProvided() bool

IsAwsProvided returns true if all required env variables have been set for using AWS S3 / Backblaze

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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