7
"github.com/joho/godotenv"
11
err := godotenv.Load(".env")
13
log.Println("---failed to load .env config file---")
14
log.Println("---loaded default settings---")
20
if _, exists := os.LookupEnv("SS_AllowOrigins"); !exists {
21
os.Setenv("SS_AllowOrigins", "*")
24
if _, exists := os.LookupEnv("SS_StaticDir"); !exists {
25
os.Setenv("SS_StaticDir", "./static")
28
if _, exists := os.LookupEnv("SS_TLS"); !exists {
29
os.Setenv("SS_TLS", "OFF")
31
if _, exists := os.LookupEnv("SS_TLS_CERT"); !exists {
32
if _, exists := os.LookupEnv("SS_DOMAIN"); !exists {
33
log.Panic("SS_DOMAIN is not set")
35
if _, exists := os.LookupEnv("SS_CrtDir"); !exists {
36
log.Println("SS_CrtDir is not set. Default dir ./certs")
37
os.Setenv("SS_CrtDir", "./certs")
42
if _, exists := os.LookupEnv("SS_PORT"); !exists {
43
os.Setenv("SS_PORT", ":8080")
46
log.Printf(`OIO-Static_Server settings:
51
`, os.Getenv("SS_AllowOrigins"), os.Getenv("SS_StaticDir"), os.Getenv("SS_PORT"), os.Getenv("SS_TLS"))