aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..3467f3f
--- /dev/null
+++ b/main.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "flag"
+ "net"
+ "net/http"
+
+ "go.lindenii.runxiyu.org/lindenii-common/clog"
+)
+
+func main() {
+ config_path := flag.String(
+ "config",
+ "/etc/lindenii/forge.scfg",
+ "path to configuration file",
+ )
+ flag.Parse()
+
+ err := load_config(*config_path)
+ if err != nil {
+ clog.Fatal(1, "Loading configuration: "+err.Error())
+ }
+
+ err = load_templates()
+ if err != nil {
+ clog.Fatal(1, "Loading templates: "+err.Error())
+ }
+
+ http.HandleFunc("/{$}", handle_index)
+
+ listener, err := net.Listen(config.HTTP.Net, config.HTTP.Addr)
+ if err != nil {
+ clog.Fatal(1, "Listening: "+err.Error())
+ }
+
+ http.Serve(listener, nil)
+}