summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-19 11:04:20 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-19 11:04:20 -0800
commit43fd3472dd9d19aa1f602ce3fd3555f03312b99b (patch)
treefcd1a2e891a530d8812538c8bebe39f6fc491980
parentbab8caaf4d599da47f296bc9e2940b11cb37aa4f (diff)
adding http port to config and removing hardcoded url from addons api
-rw-r--r--cmd/ponzu/main.go4
-rw-r--r--system/addon/api.go1
-rw-r--r--system/admin/admin.go7
-rw-r--r--system/admin/handlers.go2
-rw-r--r--system/db/config.go7
5 files changed, 3 insertions, 18 deletions
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go
index c03a4df..b2b5e75 100644
--- a/cmd/ponzu/main.go
+++ b/cmd/ponzu/main.go
@@ -296,15 +296,11 @@ func main() {
// save the port the system is listening on so internal system can make
// HTTP api calls while in dev or production w/o adding more cli flags
- fmt.Println(port, "port from main")
err := db.PutConfig("http_port", fmt.Sprintf("%d", port))
if err != nil {
log.Fatalln("System failed to save config. Please try to run again.")
}
- cfg, _ := db.ConfigAll()
- fmt.Println(string(cfg))
-
log.Fatalln(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
case "":
diff --git a/system/addon/api.go b/system/addon/api.go
index 7df31ef..4c3152b 100644
--- a/system/addon/api.go
+++ b/system/addon/api.go
@@ -20,7 +20,6 @@ func ContentAll(namespace string) []byte {
buf := []byte{}
r := bytes.NewReader(buf)
url := fmt.Sprintf(endpoint, host, port, namespace)
- fmt.Println(url)
req, err := http.NewRequest(http.MethodGet, url, r)
if err != nil {
diff --git a/system/admin/admin.go b/system/admin/admin.go
index 768a740..78f607d 100644
--- a/system/admin/admin.go
+++ b/system/admin/admin.go
@@ -86,10 +86,9 @@ var endAdminHTML = `
</html>`
type admin struct {
- Logo string
- Types map[string]func() interface{}
- Subview template.HTML
- HTTPPort string
+ Logo string
+ Types map[string]func() interface{}
+ Subview template.HTML
}
// Admin ...
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index b9408cf..266535a 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -85,7 +85,6 @@ func initHandler(res http.ResponseWriter, req *http.Request) {
// set HTTP port which should be previously added to config cache
port := db.ConfigCache("http_port")
- fmt.Println("port from config (init handler)", port)
req.Form.Set("http_port", port)
// set initial user email as admin_email and make config
@@ -1294,7 +1293,6 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
}
if len(data) < 1 || data == nil {
- fmt.Println(string(data))
res.WriteHeader(http.StatusNotFound)
errView, err := Error404()
if err != nil {
diff --git a/system/db/config.go b/system/db/config.go
index 711a19b..4bbf29b 100644
--- a/system/db/config.go
+++ b/system/db/config.go
@@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
- "log"
"net/url"
"strings"
@@ -22,7 +21,6 @@ func init() {
// SetConfig sets key:value pairs in the db for configuration settings
func SetConfig(data url.Values) error {
- fmt.Println("SetConfig:", data)
err := store.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("__config"))
@@ -122,7 +120,6 @@ func ConfigAll() ([]byte, error) {
// PutConfig updates a single k/v in the config
func PutConfig(key string, value interface{}) error {
- fmt.Println("PutConfig:", key, value)
kv := make(map[string]interface{})
c, err := ConfigAll()
@@ -151,14 +148,10 @@ func PutConfig(key string, value interface{}) error {
}
default:
- log.Println("No type case for:", k, v, "in PutConfig")
data.Set(k, fmt.Sprintf("%v", v))
}
}
- fmt.Println("data should match 2 lines below:")
- fmt.Println("PutConfig:", data)
-
err = SetConfig(data)
if err != nil {
return err