environment

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: AGPL-3.0 Imports: 7 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 {
	ChunkSizeMB        int    `env:"CHUNK_SIZE_MB" envDefault:"45"`
	ConfigDir          string `env:"CONFIG_DIR" envDefault:"config"`
	ConfigFile         string `env:"CONFIG_FILE" envDefault:"config.json"`
	ConfigPath         string
	DataDir            string `env:"DATA_DIR" envDefault:"data"`
	DatabaseUrl        string `env:"DATABASE_URL" envDefault:"sqlite://[data]/gokapi.sqlite"`
	LengthId           int    `env:"LENGTH_ID" envDefault:"15"`
	MaxFileSize        int    `env:"MAX_FILESIZE" envDefault:"102400"` // 102400==100GB
	MaxMemory          int    `env:"MAX_MEMORY_UPLOAD" envDefault:"50"`
	MaxParallelUploads int    `env:"MAX_PARALLEL_UPLOADS" envDefault:"4"`
	WebserverPort      int    `env:"PORT" envDefault:"53842"`
	DisableCorsCheck   bool   `env:"DISABLE_CORS_CHECK" envDefault:"false"`
	LogToStdout        bool   `env:"LOG_STDOUT" envDefault:"false"`
	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"`
	AwsProxyDownload   bool   `env:"AWS_PROXY_DOWNLOAD" envDefault:"false"`
	// deprecated
	// Will be removed with version 1.10.0
	DatabaseName string `env:"DB_NAME" envDefault:"gokapi.sqlite"`
}

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