Merge pull request #907 from influxdata/fix/move_setup_endpoint

fix /setup endpoint
pull/10616/head
kelwang 2018-09-28 12:02:56 -04:00 committed by GitHub
commit f45fbf271e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 13 deletions

View File

@ -22,8 +22,8 @@ func NewSetupHandler() *SetupHandler {
h := &SetupHandler{
Router: httprouter.New(),
}
h.HandlerFunc("POST", "/setup", h.handlePostSetup)
h.HandlerFunc("GET", "/setup", h.isOnboarding)
h.HandlerFunc("POST", "/api/v2/setup", h.handlePostSetup)
h.HandlerFunc("GET", "/api/v2/setup", h.isOnboarding)
return h
}

View File

@ -37,7 +37,7 @@ func setCORSResponseHeaders(w nethttp.ResponseWriter, r *nethttp.Request) {
}
var platformLinks = map[string]interface{}{
"setup": "/setup",
"setup": "/api/v2/setup",
"sources": "/api/v2/sources",
"dashboards": "/api/v2/dashboards",
"query": "/api/v2/query",
@ -81,8 +81,7 @@ func (h *PlatformHandler) ServeHTTP(w nethttp.ResponseWriter, r *nethttp.Request
// of the platform API.
if !strings.HasPrefix(r.URL.Path, "/v1") &&
!strings.HasPrefix(r.URL.Path, "/api/v2") &&
!strings.HasPrefix(r.URL.Path, "/chronograf/") &&
!strings.HasPrefix(r.URL.Path, "/setup") {
!strings.HasPrefix(r.URL.Path, "/chronograf/") {
h.AssetHandler.ServeHTTP(w, r)
return
}
@ -93,7 +92,7 @@ func (h *PlatformHandler) ServeHTTP(w nethttp.ResponseWriter, r *nethttp.Request
return
}
if strings.HasPrefix(r.URL.Path, "/setup") {
if strings.HasPrefix(r.URL.Path, "/api/v2/setup") {
h.SetupHandler.ServeHTTP(w, r)
return
}

View File

@ -50,14 +50,14 @@ paths:
tags:
- Setup
summary: check if database has default user, org, bucket created, returns true if not.
response:
responses:
'200':
description:
allowed true or false
content:
application/json:
type: object
properties:
allowed:
type: boolean
schema:
$ref: "#/components/schemas/IsOnboarding"
post:
tags:
- Setup
@ -75,8 +75,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/OnboardingResponse"
$ref: "#/components/schemas/OnboardingResponse"
/macros:
get:
tags:
@ -3292,6 +3291,11 @@ components:
type: array
items:
$ref: "#/components/schemas/Source"
IsOnboarding:
type: object
properties:
allowed:
type: boolean
OnboardingRequest:
type: object
properties: