summaryrefslogtreecommitdiff
path: root/app/config.go
blob: 9a5aef1f1140ca34ebe533351a2790fe5da9164e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package app

import (
	"os"
)

type cache_config struct {
	Enabled            bool
	Path               string
	Max_size, Lifetime int64
}

type config struct {
	cfg              string
	Listen, Base_uri string
	Cache            cache_config
	Proxy, Nsfw      bool
}

var CFG = config{
	cfg:      "config.json",
	Listen:   "127.0.0.1:3003",
	Base_uri: "/",
	Cache: cache_config{
		Enabled: true,
		Path:    "cache",
	},
	Proxy: true,
	Nsfw:  true,
}

func execcfg() {
	a := os.Args
	for num, val := range a {
		switch val {
		case "-conf":
			CFG.cfg = a[num]
		case "-help":
			println(`SkunkyArt v 1.3 [refactoring]
Usage:
	- -conf - path to config
	- -help this message
Example:
	./skunkyart -conf config.json
Copyright lost+skunk, X11. https://git.macaw.me/skunky/skunkyart/src/tag/v1.3`)
		}
	}
}