Initial refactor of settings.
Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
15
main.go
15
main.go
@@ -1,13 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
"github.com/ProjectSegfault/segfautils/api"
|
||||
"github.com/ProjectSegfault/segfautils/config"
|
||||
"github.com/ProjectSegfault/segfautils/utils"
|
||||
)
|
||||
|
||||
@@ -21,14 +21,13 @@ var shit bool
|
||||
|
||||
func main() {
|
||||
log.Println("[Segfautils] Starting")
|
||||
utils.CheckEnv()
|
||||
utils.CheckConfig()
|
||||
log.Println("[HTTP] Starting server")
|
||||
port := os.Getenv("SEGFAUTILS_PORT")
|
||||
hcaptcha_site_key := os.Getenv("HCAPTCHA_SITE_KEY")
|
||||
hcaptcha_site_key := config.HCaptchaSiteKey()
|
||||
tmpl := template.Must(template.ParseFiles("static/index.html"))
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
data := StaticThingy{
|
||||
Port: port,
|
||||
Port: config.Port(),
|
||||
}
|
||||
tmpl.Execute(w, data)
|
||||
})
|
||||
@@ -49,6 +48,6 @@ func main() {
|
||||
})
|
||||
api.Form()
|
||||
api.Announcements()
|
||||
log.Println("[HTTP] HTTP server is now running at " + port + "!")
|
||||
log.Println(http.ListenAndServe(":"+port, nil))
|
||||
log.Println("[HTTP] HTTP server is now running at " + config.Port() + "!")
|
||||
log.Println(http.ListenAndServe(":"+config.Port(), nil))
|
||||
}
|
||||
|
Reference in New Issue
Block a user