-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (26 loc) · 883 Bytes
/
main.go
File metadata and controls
35 lines (26 loc) · 883 Bytes
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
package main
import (
"fmt"
"os"
)
// Выводит в консоль переменные окружения и настраивает по умолчанию, если они не заданы.
func env() {
fmt.Println("Enviroment variables:")
if os.Getenv("FAKE_API_PORT") == "" {
os.Setenv("FAKE_API_PORT", "8080")
}
fmt.Println("FAKE_API_PORT:", os.Getenv("FAKE_API_PORT"))
if os.Getenv("FAKE_API_HOST") == "" {
os.Setenv("FAKE_API_HOST", "0.0.0.0")
}
fmt.Println("FAKE_API_HOST:", os.Getenv("FAKE_API_HOST"))
if os.Getenv("FAKE_API_MAX_FIELDS_IN_OBJECT") == "" {
os.Setenv("FAKE_API_MAX_FIELDS_IN_OBJECT", "50")
}
fmt.Println("FAKE_API_MAX_FIELDS_IN_OBJECT:", os.Getenv("FAKE_API_MAX_FIELDS_IN_OBJECT"))
}
// Главная точка входа в приложение. Запускает http сервер.
func main() {
env()
runHttpServer()
}