summaryrefslogtreecommitdiff
path: root/config.go
blob: 61e666fb6abb613cef45f109a76b0939146fc44c (plain)
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
package main

import (
	"log"
	"os"
)

type Config struct {
	Port string
	DB   string
}

func LoadConfig() Config {
	at := os.Getenv("STATSAT")
	if at == "" {
		log.Println("Defaulting to STATSAT=:8080")
		at = ":8080"
	}
	db := os.Getenv("STATSDB")
	if db == "" {
		log.Println("Defaulting to STATSDB=./stats.db")
		db = "./stats.db"
	}
	return Config{Port: at, DB: db}
}