-
Notifications
You must be signed in to change notification settings - Fork 0
/
appsettings.go
85 lines (74 loc) · 2.87 KB
/
appsettings.go
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
Copyright © 2019, 2024 M.Watermann, 10247 Berlin, Germany
All rights reserved
EMail : <support@mwat.de>
*/
package nele
import (
"fmt"
"strings"
)
//lint:file-ignore ST1017 - I prefer Yoda conditions
type (
// `TAppArgs` is a collection of commandline arguments and INI values.
TAppArgs struct {
AccessLog string // (optional) name of page access logfile
Addr string // listen address ("1.2.3.4:5678")
BlogName string // name/description of this blog
CertKey string // TLS certificate key
CertPem string // private TLS certificate
DataDir string // base directory of application's data
delWhitespace bool // remove whitespace from generated pages
Dump bool // Debug: dump this structure to `StdOut`
ErrorLog string // (optional) name of page error logfile
GZip bool // send compressed data to remote browser
HashFile string // file of hashtag/mention database
// Intl string // path/filename of the localisation file
Lang string // default GUI language
listen string // IP of host to listen at
LogStack bool // log stack trace in case of errors
MaxFileSize int64 // max. upload file size
mfs string // max. upload file size
Name string // name of the actual program
PageLength uint // the number of postings to show per page
persistence string // either `db`, `fs`, or `tee`.`
PostAdd bool // whether to write a posting from commandline
PostFile string // name of file to post
port int // port to listen to
Realm string // host/domain to secure by BasicAuth
Screenshot bool // whether to use page screenshots or not
Theme string // `dark` or `light` display theme
UserAdd string // username to add to password list
UserCheck string // username to check in password list
UserDelete string // username to delete from password list
UserFile string // (optional) name of page access logfile
UserList bool // print out a list of current users
UserUpdate string // username to update in password list
}
)
var (
// `AppArgs` holds the commandline arguments and INI values combined.
//
// This structure should be considered `R/O` after it was set up
// by a call to `InitConfig()`.
AppArgs TAppArgs
)
// `String()` implements the `Stringer` interface returning a (pretty
// printed) string representation of the current `TAppArgs` instance.
//
// NOTE: This method is meant mostly for debugging purposes.
//
// Returns:
// - `string`: The string representation of the current app configuration.
func (aa TAppArgs) String() string {
return strings.Replace(
strings.Replace(
strings.Replace(
strings.Replace(
fmt.Sprintf("%#v", aa),
`, `, ",\n\t", -1),
`{`, "{\n\t", -1),
`}`, ",\n}", -1),
`:`, ` : `, -1) //FIXME this affects property values as well!
} // String()
/* _EoF_ */