-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (35 loc) · 893 Bytes
/
main.go
File metadata and controls
44 lines (35 loc) · 893 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
36
37
38
39
40
41
42
43
44
package main
import (
"flag"
"fmt"
"os"
)
var version = "master"
var debugMode bool
type serverConfig struct {
port int
credentials []string
debug bool
browser bool
}
func errorAndExit(err error, code int) {
fmt.Println(fmt.Errorf("Error: %v", err))
os.Exit(code)
}
func main() {
fmt.Println("Search Plugins", "v"+version, "by Doğan Çelik (dogancelik.com)")
fmt.Println("Starting Search Plugins server…")
portPtr := flag.Int("p", 8080, "server port")
credPtr := flag.String("c", "admin:123456", "admin username & password")
debugPtr := flag.Bool("d", false, "disable or enable logging")
browserPtr := flag.Bool("o", false, "open browser")
flag.Parse()
err, creds := splitCreds(*credPtr)
if err != nil {
errorAndExit(err, 1)
}
debugMode = *debugPtr
cfg := serverConfig{*portPtr, creds, debugMode, *browserPtr}
initWeb()
startServer(cfg)
}