diff --git a/pkg/api/api_generic_handlers.go b/pkg/api/api_generic_handlers.go index 93ab2608e..74ffdbbd6 100644 --- a/pkg/api/api_generic_handlers.go +++ b/pkg/api/api_generic_handlers.go @@ -20,7 +20,7 @@ import ( "net/http" "strings" - "github.com/minio-io/minio/pkg/utils/config" + "github.com/minio-io/minio/pkg/api/config" ) type vHandler struct { diff --git a/pkg/api/api_object.go b/pkg/api/api_object_handlers.go similarity index 100% rename from pkg/api/api_object.go rename to pkg/api/api_object_handlers.go diff --git a/pkg/api/api_policy.go b/pkg/api/api_policy_handlers.go similarity index 100% rename from pkg/api/api_policy.go rename to pkg/api/api_policy_handlers.go diff --git a/pkg/api/api_router.go b/pkg/api/api_router.go index 62343c4ba..35449b1a5 100644 --- a/pkg/api/api_router.go +++ b/pkg/api/api_router.go @@ -20,9 +20,9 @@ import ( "log" "net/http" - x "github.com/gorilla/mux" + router "github.com/gorilla/mux" + "github.com/minio-io/minio/pkg/api/config" mstorage "github.com/minio-io/minio/pkg/storage" - "github.com/minio-io/minio/pkg/utils/config" ) // private use @@ -32,7 +32,7 @@ type minioAPI struct { } // Path based routing -func pathMux(api minioAPI, mux *x.Router) *x.Router { +func pathMux(api minioAPI, mux *router.Router) *router.Router { mux.HandleFunc("/", api.listBucketsHandler).Methods("GET") mux.HandleFunc("/{bucket}", api.listObjectsHandler).Methods("GET") mux.HandleFunc("/{bucket}", api.putBucketHandler).Methods("PUT") @@ -44,7 +44,7 @@ func pathMux(api minioAPI, mux *x.Router) *x.Router { } // Domain based routing -func domainMux(api minioAPI, mux *x.Router) *x.Router { +func domainMux(api minioAPI, mux *router.Router) *router.Router { mux.HandleFunc("/", api.listObjectsHandler).Host("{bucket}" + "." + api.domain).Methods("GET") mux.HandleFunc("/{object:.*}", @@ -60,7 +60,7 @@ func domainMux(api minioAPI, mux *x.Router) *x.Router { } // Get proper router based on domain availability -func getMux(api minioAPI, mux *x.Router) *x.Router { +func getMux(api minioAPI, mux *router.Router) *router.Router { switch true { case api.domain == "": return pathMux(api, mux) @@ -73,12 +73,12 @@ func getMux(api minioAPI, mux *x.Router) *x.Router { // HTTPHandler - http wrapper handler func HTTPHandler(domain string, storage mstorage.Storage) http.Handler { - var mux *x.Router + var mux *router.Router var api = minioAPI{} api.storage = storage api.domain = domain - r := x.NewRouter() + r := router.NewRouter() mux = getMux(api, r) var conf = config.Config{} diff --git a/pkg/api/api_signature.go b/pkg/api/api_signature.go index 4c8fd6f63..cf046b7d4 100644 --- a/pkg/api/api_signature.go +++ b/pkg/api/api_signature.go @@ -18,20 +18,21 @@ package api import ( "bytes" - "crypto/hmac" - "crypto/sha1" - "encoding/base64" "errors" "fmt" "io" "net" - "net/http" - "net/url" "sort" "strings" "time" - "github.com/minio-io/minio/pkg/utils/config" + "crypto/hmac" + "crypto/sha1" + "encoding/base64" + "net/http" + "net/url" + + "github.com/minio-io/minio/pkg/api/config" ) // SignRequest - a given http request using HMAC style signatures diff --git a/pkg/utils/config/config.go b/pkg/api/config/config.go similarity index 100% rename from pkg/utils/config/config.go rename to pkg/api/config/config.go diff --git a/pkg/utils/config/config_test.go b/pkg/api/config/config_test.go similarity index 93% rename from pkg/utils/config/config_test.go rename to pkg/api/config/config_test.go index 5c57cb806..6f0c58727 100644 --- a/pkg/utils/config/config_test.go +++ b/pkg/api/config/config_test.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package config_test +package config import ( "io/ioutil" @@ -23,7 +23,6 @@ import ( "sync" "testing" - "github.com/minio-io/minio/pkg/utils/config" "github.com/minio-io/minio/pkg/utils/crypto/keys" . "gopkg.in/check.v1" ) @@ -35,7 +34,8 @@ var _ = Suite(&MySuite{}) func Test(t *testing.T) { TestingT(t) } func (s *MySuite) TestConfig(c *C) { - conf := config.Config{} + conf := Config{} + conf.ConfigLock = new(sync.RWMutex) conf.ConfigPath, _ = ioutil.TempDir("/tmp", "minio-test-") defer os.RemoveAll(conf.ConfigPath) conf.ConfigFile = path.Join(conf.ConfigPath, "config.json") @@ -45,12 +45,11 @@ func (s *MySuite) TestConfig(c *C) { c.Fatal(err) } } - conf.ConfigLock = new(sync.RWMutex) accesskey, _ := keys.GenerateRandomAlphaNumeric(keys.MinioAccessID) secretkey, _ := keys.GenerateRandomBase64(keys.MinioSecretID) - user := config.User{ + user := User{ Name: "gnubot", AccessKey: string(accesskey), SecretKey: string(secretkey), @@ -65,7 +64,7 @@ func (s *MySuite) TestConfig(c *C) { accesskey, _ = keys.GenerateRandomAlphaNumeric(keys.MinioAccessID) secretkey, _ = keys.GenerateRandomBase64(keys.MinioSecretID) - user = config.User{ + user = User{ Name: "minio", AccessKey: string(accesskey), SecretKey: string(secretkey), diff --git a/pkg/api/web/web.go b/pkg/api/web/web.go index 5e2ae7931..5158f46b1 100644 --- a/pkg/api/web/web.go +++ b/pkg/api/web/web.go @@ -24,7 +24,7 @@ import ( "path" "github.com/gorilla/mux" - "github.com/minio-io/minio/pkg/utils/config" + "github.com/minio-io/minio/pkg/api/config" "github.com/minio-io/minio/pkg/utils/crypto/keys" )