This is an automated email from the ASF dual-hosted git repository.

dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 4af62f3  move config.go into config package so it can be used by other 
packages
4af62f3 is described below

commit 4af62f3d34c2e5b1c64f026a1b36ec50aa9eb22a
Author: Dylan Volz <dylan_v...@comcast.com>
AuthorDate: Tue Mar 13 14:38:34 2018 -0600

    move config.go into config package so it can be used by other packages
---
 traffic_ops/traffic_ops_golang/{ => config}/config.go      | 2 +-
 traffic_ops/traffic_ops_golang/{ => config}/config_test.go | 2 +-
 traffic_ops/traffic_ops_golang/deliveryservices_keys.go    | 9 +++++----
 traffic_ops/traffic_ops_golang/routing.go                  | 3 ++-
 traffic_ops/traffic_ops_golang/traffic_ops_golang.go       | 5 +++--
 traffic_ops/traffic_ops_golang/urisigning.go               | 7 ++++---
 traffic_ops/traffic_ops_golang/wrappers_test.go            | 3 +++
 7 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/config.go 
b/traffic_ops/traffic_ops_golang/config/config.go
similarity index 99%
rename from traffic_ops/traffic_ops_golang/config.go
rename to traffic_ops/traffic_ops_golang/config/config.go
index 0d58dab..1a5ebdd 100644
--- a/traffic_ops/traffic_ops_golang/config.go
+++ b/traffic_ops/traffic_ops_golang/config/config.go
@@ -1,4 +1,4 @@
-package main
+package config
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/traffic_ops/traffic_ops_golang/config_test.go 
b/traffic_ops/traffic_ops_golang/config/config_test.go
similarity index 99%
rename from traffic_ops/traffic_ops_golang/config_test.go
rename to traffic_ops/traffic_ops_golang/config/config_test.go
index 366d7fe..7e7ef8f 100644
--- a/traffic_ops/traffic_ops_golang/config_test.go
+++ b/traffic_ops/traffic_ops_golang/config/config_test.go
@@ -1,4 +1,4 @@
-package main
+package config
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/traffic_ops/traffic_ops_golang/deliveryservices_keys.go 
b/traffic_ops/traffic_ops_golang/deliveryservices_keys.go
index 11a6de0..dadf694 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservices_keys.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservices_keys.go
@@ -35,6 +35,7 @@ import (
        "github.com/apache/incubator-trafficcontrol/lib/go-tc"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/api"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/auth"
+       
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/config"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/riaksvc"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/tenant"
        "github.com/basho/riak-go-client"
@@ -99,7 +100,7 @@ func getXMLID(cdnID sql.NullInt64, hostRegex string, db 
*sqlx.DB) (sql.NullStrin
        return xmlID, nil
 }
 
-func getDeliveryServiceSSLKeysByXMLID(xmlID string, version string, db 
*sqlx.DB, cfg Config) ([]byte, error) {
+func getDeliveryServiceSSLKeysByXMLID(xmlID string, version string, db 
*sqlx.DB, cfg config.Config) ([]byte, error) {
        var respBytes []byte
        // create and start a cluster
        cluster, err := riaksvc.GetRiakCluster(db, cfg.RiakAuthOptions)
@@ -241,7 +242,7 @@ func verifyAndEncodeCertificate(certificate string, rootCA 
string) (string, erro
        return base64EncodedStr, nil
 }
 
-func addDeliveryServiceSSLKeysHandler(db *sqlx.DB, cfg Config) 
http.HandlerFunc {
+func addDeliveryServiceSSLKeysHandler(db *sqlx.DB, cfg config.Config) 
http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
                handleErr := tc.GetHandleErrorsFunc(w, r)
                var keysObj tc.DeliveryServiceSSLKeys
@@ -338,7 +339,7 @@ func addDeliveryServiceSSLKeysHandler(db *sqlx.DB, cfg 
Config) http.HandlerFunc
 }
 
 // fetch the ssl keys for a deliveryservice specified by the fully qualified 
hostname
-func getDeliveryServiceSSLKeysByHostNameHandler(db *sqlx.DB, cfg Config) 
http.HandlerFunc {
+func getDeliveryServiceSSLKeysByHostNameHandler(db *sqlx.DB, cfg 
config.Config) http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
                handleErr := tc.GetHandleErrorsFunc(w, r)
                var respBytes []byte
@@ -442,7 +443,7 @@ func getDeliveryServiceSSLKeysByHostNameHandler(db 
*sqlx.DB, cfg Config) http.Ha
 }
 
 // fetch the deliveryservice ssl keys by the specified xmlID.
-func getDeliveryServiceSSLKeysByXMLIDHandler(db *sqlx.DB, cfg Config) 
http.HandlerFunc {
+func getDeliveryServiceSSLKeysByXMLIDHandler(db *sqlx.DB, cfg config.Config) 
http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
                handleErr := tc.GetHandleErrorsFunc(w, r)
                var respBytes []byte
diff --git a/traffic_ops/traffic_ops_golang/routing.go 
b/traffic_ops/traffic_ops_golang/routing.go
index a940d5d..2fce1bb 100644
--- a/traffic_ops/traffic_ops_golang/routing.go
+++ b/traffic_ops/traffic_ops_golang/routing.go
@@ -32,6 +32,7 @@ import (
        "fmt"
 
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/api"
+       
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/config"
        "github.com/jmoiron/sqlx"
 )
 
@@ -59,7 +60,7 @@ func getDefaultMiddleware() []Middleware {
 
 // ServerData ...
 type ServerData struct {
-       Config
+       config.Config
        DB *sqlx.DB
 }
 
diff --git a/traffic_ops/traffic_ops_golang/traffic_ops_golang.go 
b/traffic_ops/traffic_ops_golang/traffic_ops_golang.go
index dfd5f27..cc95281 100644
--- a/traffic_ops/traffic_ops_golang/traffic_ops_golang.go
+++ b/traffic_ops/traffic_ops_golang/traffic_ops_golang.go
@@ -30,6 +30,7 @@ import (
 
        "github.com/apache/incubator-trafficcontrol/lib/go-log"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/about"
+       
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/config"
 
        "github.com/jmoiron/sqlx"
        _ "github.com/lib/pq"
@@ -58,10 +59,10 @@ func main() {
                os.Exit(1)
        }
 
-       var cfg Config
+       var cfg config.Config
        var err error
        var errorToLog error
-       if cfg, err = LoadConfig(*configFileName, *dbConfigFileName, 
*riakConfigFileName); err != nil {
+       if cfg, err = config.LoadConfig(*configFileName, *dbConfigFileName, 
*riakConfigFileName); err != nil {
                if !strings.Contains(err.Error(), "riak conf") {
                        fmt.Println("Error loading config: " + err.Error())
                        return
diff --git a/traffic_ops/traffic_ops_golang/urisigning.go 
b/traffic_ops/traffic_ops_golang/urisigning.go
index 2fddee8..50679fd 100644
--- a/traffic_ops/traffic_ops_golang/urisigning.go
+++ b/traffic_ops/traffic_ops_golang/urisigning.go
@@ -31,6 +31,7 @@ import (
        "github.com/apache/incubator-trafficcontrol/lib/go-tc"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/api"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/auth"
+       
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/config"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/riaksvc"
        
"github.com/apache/incubator-trafficcontrol/traffic_ops/traffic_ops_golang/tenant"
        "github.com/basho/riak-go-client"
@@ -48,7 +49,7 @@ type URISignerKeyset struct {
 }
 
 // endpoint handler for fetching uri signing keys from riak
-func getURIsignkeysHandler(db *sqlx.DB, cfg Config) http.HandlerFunc {
+func getURIsignkeysHandler(db *sqlx.DB, cfg config.Config) http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
                handleErr := tc.GetHandleErrorsFunc(w, r)
 
@@ -130,7 +131,7 @@ func getURIsignkeysHandler(db *sqlx.DB, cfg Config) 
http.HandlerFunc {
 }
 
 // Http DELETE handler used to remove urisigning keys assigned to a delivery 
service.
-func removeDeliveryServiceURIKeysHandler(db *sqlx.DB, cfg Config) 
http.HandlerFunc {
+func removeDeliveryServiceURIKeysHandler(db *sqlx.DB, cfg config.Config) 
http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
                handleErr := tc.GetHandleErrorsFunc(w, r)
 
@@ -218,7 +219,7 @@ func removeDeliveryServiceURIKeysHandler(db *sqlx.DB, cfg 
Config) http.HandlerFu
 }
 
 // Http POST or PUT handler used to store urisigning keys to a delivery 
service.
-func saveDeliveryServiceURIKeysHandler(db *sqlx.DB, cfg Config) 
http.HandlerFunc {
+func saveDeliveryServiceURIKeysHandler(db *sqlx.DB, cfg config.Config) 
http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
                handleErr := tc.GetHandleErrorsFunc(w, r)
 
diff --git a/traffic_ops/traffic_ops_golang/wrappers_test.go 
b/traffic_ops/traffic_ops_golang/wrappers_test.go
index ab79ef2..4638a8e 100644
--- a/traffic_ops/traffic_ops_golang/wrappers_test.go
+++ b/traffic_ops/traffic_ops_golang/wrappers_test.go
@@ -23,6 +23,7 @@ import (
        "bytes"
        "compress/gzip"
        "encoding/json"
+       "flag"
        "net/http"
        "net/http/httptest"
        "testing"
@@ -38,6 +39,8 @@ import (
        sqlmock "gopkg.in/DATA-DOG/go-sqlmock.v1"
 )
 
+var debugLogging = flag.Bool("debug", false, "enable debug logging in test")
+
 // TestWrapHeaders checks that appropriate default headers are added to a 
request
 func TestWrapHeaders(t *testing.T) {
        body := "We are here!!"

-- 
To stop receiving notification emails like this one, please contact
dang...@apache.org.

Reply via email to