In order to mitigate against the brute force attacks against Gitlab accounts, we are moving to all edu-ID Logins. We would like to remind you to link your account with your edu-id. Login will be possible only by edu-ID after December 31, 2021. Here you can find the instructions for linking your account.

If you don't have a SWITCH edu-ID, you can create one with this guide here

kind regards

config.go 1.21 KB
Newer Older
Jürgen Enge's avatar
Jürgen Enge committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
	"github.com/BurntSushi/toml"
	"log"
	"time"
)

type duration struct {
	Duration time.Duration
}

func (d *duration) UnmarshalText(text []byte) error {
	var err error
	d.Duration, err = time.ParseDuration(string(text))
	return err
}

type ConfigImageMagick struct {
	Identify string
	Convert  string
Jürgen Enge's avatar
Jürgen Enge committed
22
23
24
25
26
27
28
29
30
31
}

type ConfigFFMPEG struct {
	FFMPEG  string
	FFPROBE string
}

type ConfigHistogram struct {
	Prefix   string
	Colormap map[string]string
Jürgen Enge's avatar
Jürgen Enge committed
32
33
34
35
36
37
	Timeout  duration
	Remap    string
	Colors   int
	Resize   string
}

Jürgen Enge's avatar
Jürgen Enge committed
38
39
40
41
42
43
44
45
46
47
type ConfigValidateImage struct {
	Prefix  string
	Timeout duration
}

type ConfigValidateAV struct {
	Prefix  string
	Timeout duration
}

Jürgen Enge's avatar
Jürgen Enge committed
48
type Config struct {
Jürgen Enge's avatar
Jürgen Enge committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	Logfile       string
	Loglevel      string
	AccessLog     string
	CertPEM       string
	KeyPEM        string
	Addr          string
	JwtKey        string
	JwtAlg        []string
	ImageMagick   ConfigImageMagick
	ConfigFFMPEG  ConfigFFMPEG
	Histogram     ConfigHistogram
	ValidateImage ConfigValidateImage
	ValidateAV    ConfigValidateAV
	Wsl           bool
Jürgen Enge's avatar
Jürgen Enge committed
63
64
65
66
67
68
69
70
71
72
}

func LoadConfig(filepath string) Config {
	var conf Config
	_, err := toml.DecodeFile(filepath, &conf)
	if err != nil {
		log.Fatalln("Error on loading config: ", err)
	}
	return conf
}