Add app system info to global config
Signed-off-by: Adrien Kara <adrien@iglou.eu>
This commit is contained in:
parent
fb528ac208
commit
bbc8b88cd1
|
@ -20,6 +20,8 @@ type Config struct {
|
|||
// UI configuration
|
||||
UI UI `json:"ui"`
|
||||
|
||||
// OS store the os information
|
||||
OS OS `json:"-"`
|
||||
// The Config file path
|
||||
ConfigFile string `json:"-"`
|
||||
}
|
||||
|
@ -79,6 +81,16 @@ type Meta struct {
|
|||
TitlePrefix string `json:"title_prefix"`
|
||||
}
|
||||
|
||||
type OS struct {
|
||||
// PID of the process
|
||||
PID int
|
||||
// GID of app user
|
||||
GID int
|
||||
// UID of app user
|
||||
UID int
|
||||
}
|
||||
|
||||
// CLI struct is to store the command line arguments values
|
||||
type CLI struct {
|
||||
Port string
|
||||
Host string
|
||||
|
@ -94,6 +106,11 @@ var cli CLI
|
|||
|
||||
// Initialize the configuration
|
||||
func Init() {
|
||||
// Save the app system information
|
||||
Data.OS.PID = os.Getpid()
|
||||
Data.OS.GID = os.Getegid()
|
||||
Data.OS.UID = os.Geteuid()
|
||||
|
||||
// Get configuration from the command line
|
||||
flag.StringVar(&cli.Port, "port", "", "The port exposed by the server")
|
||||
flag.StringVar(&cli.Host, "host", "", "The host addr where the server will listen")
|
||||
|
|
Loading…
Reference in New Issue