From 7d87d40f8d0550331d1b19dea2c374ecfbc77d48 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sun, 18 Dec 2016 12:13:08 -0800 Subject: adding beginning of addon api (cooresponding to previous commit w/ reference addon) --- system/admin/config/config.go | 1 + system/admin/handlers.go | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'system/admin') diff --git a/system/admin/config/config.go b/system/admin/config/config.go index b898b49..2e957ed 100644 --- a/system/admin/config/config.go +++ b/system/admin/config/config.go @@ -12,6 +12,7 @@ type Config struct { Name string `json:"name"` Domain string `json:"domain"` + HTTPPort string `json:"http_port"` AdminEmail string `json:"admin_email"` ClientSecret string `json:"client_secret"` Etag string `json:"etag"` diff --git a/system/admin/handlers.go b/system/admin/handlers.go index fed77f7..55a5f30 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -71,6 +71,7 @@ func initHandler(res http.ResponseWriter, req *http.Request) { etag := db.NewEtag() req.Form.Set("etag", etag) + // create and save admin user email := strings.ToLower(req.FormValue("email")) password := req.FormValue("password") usr := user.NewUser(email, password) @@ -82,6 +83,10 @@ func initHandler(res http.ResponseWriter, req *http.Request) { return } + // set HTTP port which should be previously added to config cache + port := db.ConfigCache("http_port") + req.Form.Set("http_port", port) + // set initial user email as admin_email and make config req.Form.Set("admin_email", email) err = db.SetConfig(req.Form) -- cgit v1.2.3