util

package
v0.0.0-...-5419c58 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = Configuration{
	ListenAddr:       ":8080",
	BaseURL:          "http://localhost:8080",
	DisplayURL:       "",
	DataDir:          "data",
	Backend:          "boltdb",
	EnableDebugMode:  false,
	EnableAccessLogs: true,
	EnableColorLogs:  true,
	UseSSL:           false,
	ShortedIDLength:  4,
	AuthBackend:      "oauth",
	Redis: redisConf{
		Host:         "127.0.0.1:6379",
		MaxRetries:   3,
		ReadTimeout:  "3s",
		WriteTimeout: "3s",
		SessionDB:    "1",
		SharedKey:    "secret",
	},
}

Config contains the default values

Functions

func CheckForPrivateKey

func CheckForPrivateKey() error

CheckForPrivateKey checks if already an private key exists, if not it will be randomly generated and saved as a private.dat file in the data directory

func GetPrivateKey

func GetPrivateKey() []byte

GetPrivateKey returns the private key

func ReadInConfig

func ReadInConfig() error

ReadInConfig loads the Configuration and other needed folders for further usage

func SetConfig

func SetConfig(c Configuration)

SetConfig sets the configuration into the memory

Types

type Configuration

type Configuration struct {
	ListenAddr       string        `yaml:"ListenAddr" env:"LISTEN_ADDR"`
	BaseURL          string        `yaml:"BaseURL" env:"BASE_URL"`
	DisplayURL       string        `yaml:"DisplayURL" env:"DISPLAY_URL"`
	DataDir          string        `yaml:"DataDir" env:"DATA_DIR"`
	Backend          string        `yaml:"Backend" env:"BACKEND"`
	AuthBackend      string        `yaml:"AuthBackend" env:"AUTH_BACKEND"`
	UseSSL           bool          `yaml:"EnableSSL" env:"USE_SSL"`
	EnableDebugMode  bool          `yaml:"EnableDebugMode" env:"ENABLE_DEBUG_MODE"`
	EnableAccessLogs bool          `yaml:"EnableAccessLogs" env:"ENABLE_ACCESS_LOGS"`
	EnableColorLogs  bool          `yaml:"EnableColorLogs" env:"ENABLE_COLOR_LOGS"`
	ShortedIDLength  int           `yaml:"ShortedIDLength" env:"SHORTED_ID_LENGTH"`
	Google           oAuthConf     `yaml:"Google" env:"GOOGLE"`
	GitHub           oAuthConf     `yaml:"GitHub" env:"GITHUB"`
	Microsoft        oAuthConf     `yaml:"Microsoft" env:"MICROSOFT"`
	Okta             oAuthConf     `yaml:"Okta" env:"OKTA"`
	GenericOIDC      oAuthConf     `yaml:"GenericOIDC" env:"GENERIC_OIDC"`
	Proxy            proxyAuthConf `yaml:"Proxy" env:"PROXY"`
	Redis            redisConf     `yaml:"Redis" env:"REDIS"`
}

Configuration are the available config values

func GetConfig

func GetConfig() Configuration

GetConfig returns the configuration from the memory

type Info

type Info struct {
	NodeJS          string `json:"nodeJS"`
	Commit          string `json:"commit"`
	Yarn            string `json:"yarn"`
	CompilationTime string `json:"compilationTime"`
}

Info holds the information which will be added at build time

var VersionInfo Info

VersionInfo are the information which will be added at build time and shown in the frontend under the about tab

Jump to

Keyboard shortcuts

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