blob: e1f7e6864105fe3de7e25acac775283fac8aaf99 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package main
import (
"fmt"
"mandible/config"
mandible "mandible/server"
"os"
)
func main() {
configFile := os.Getenv("IMGUR_GO_CONF")
if configFile == "" {
configFile = "config/conf.json"
}
config := config.NewConfiguration(configFile)
port := ":" + os.Getenv("PORT")
if port == ":" {
port = fmt.Sprintf(":%d", config.Port)
}
if os.Getenv("UPLOAD_URL") == "" {
os.Setenv("UPLOAD_URL", "http://127.0.0.1"+port)
}
if os.Getenv("ORIGIN_URL") == "" {
os.Setenv("ORIGIN_URL", os.Getenv("UPLOAD_URL"))
}
if os.Getenv("STATIC_DIR") == "" {
os.Setenv("STATIC_DIR", (config.Stores[0]["StoreRoot"])+"/../static")
}
if os.Getenv("UPLOAD_DIR") == "" {
os.Setenv("UPLOAD_DIR", (config.Stores[0]["StoreRoot"]))
}
server := mandible.CreateServer(config)
server.Start()
}
|