Last change
on this file since 128 was 127, checked in by asciimoo, 5 years ago |
[mod] create own module for config
|
File size:
569 bytes
|
Line | |
---|
1 | package config
|
---|
2 |
|
---|
3 | import (
|
---|
4 | "os"
|
---|
5 | )
|
---|
6 |
|
---|
7 | type Config struct {
|
---|
8 | Debug bool
|
---|
9 | ListenAddress string
|
---|
10 | Key string
|
---|
11 | IPV6 bool
|
---|
12 | RequestTimeout uint
|
---|
13 | }
|
---|
14 |
|
---|
15 | var DefaultConfig *Config
|
---|
16 |
|
---|
17 | func init() {
|
---|
18 | default_listen_addr := os.Getenv("MORTY_ADDRESS")
|
---|
19 | if default_listen_addr == "" {
|
---|
20 | default_listen_addr = "127.0.0.1:3000"
|
---|
21 | }
|
---|
22 | default_key := os.Getenv("MORTY_KEY")
|
---|
23 | DefaultConfig = &Config{
|
---|
24 | Debug: os.Getenv("DEBUG") != "false",
|
---|
25 | ListenAddress: default_listen_addr,
|
---|
26 | Key: default_key,
|
---|
27 | IPV6: true,
|
---|
28 | RequestTimeout: 5,
|
---|
29 | }
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.