Swagger returning only 404s
This commit is contained in:
parent
c8508a4976
commit
f77d2bc8cf
@ -9,9 +9,15 @@ RUN go get github.com/beego/bee/v2 && go install github.com/beego/bee/v2@master
|
||||
# Generating the swagger
|
||||
RUN timeout 20 bee run -gendoc=true -downdoc=true -runmode=dev || :
|
||||
|
||||
RUN ls swagger/
|
||||
|
||||
RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html
|
||||
RUN sed -i 's/https:\/\/petstore.swagger.io\/v2\/swagger.json/swagger.json/g' swagger/index.html
|
||||
|
||||
RUN echo '------------------------------------------------------------'
|
||||
RUN cat 'swagger/index.html'
|
||||
RUN echo '------------------------------------------------------------'
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" .
|
||||
|
||||
FROM scratch
|
||||
|
@ -2,7 +2,7 @@ version: '3.4'
|
||||
|
||||
services:
|
||||
oc-catalog:
|
||||
image: oc-catalog:latest
|
||||
image: oc-catalog:debugging
|
||||
restart: always
|
||||
environment:
|
||||
- DOCKER_DCNAME=DC_myDC
|
||||
|
@ -21,6 +21,9 @@ services:
|
||||
- catalog
|
||||
ports:
|
||||
- 8081:8081
|
||||
environment:
|
||||
- ME_CONFIG_BASICAUTH_USERNAME=test
|
||||
- ME_CONFIG_BASICAUTH_PASSWORD=test
|
||||
|
||||
volumes:
|
||||
oc-catalog-data:
|
||||
|
5
docker_catalog.json
Normal file
5
docker_catalog.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"MongoURL" : "mongodb://mongo:27017/",
|
||||
"DCNAME" : "DC_myDC",
|
||||
"DBPOINT" : "demo_06042021"
|
||||
}
|
5
local_catalog.json
Normal file
5
local_catalog.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"MongoURL" : "mongodb://127.0.0.1:27017/",
|
||||
"DCNAME" : "DC_myDC",
|
||||
"DBPOINT" : "demo_06042021"
|
||||
}
|
2
main.go
2
main.go
@ -75,6 +75,6 @@ func loadConfig(){
|
||||
|
||||
conf.GetConfig().MongoURL = o.GetStringDefault("MongoURL", "mongodb://127.0.0.1:27017")
|
||||
conf.GetConfig().DCNAME = o.GetStringDefault("DCNAME", "DC_myDC")
|
||||
conf.GetConfig().DBPOINT = o.GetStringDefault("DBPOINT", "demdemo_06042021o")
|
||||
conf.GetConfig().DBPOINT = o.GetStringDefault("DBPOINT", "demo_06042021")
|
||||
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ func Init() {
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
beego.AddNamespace(ns)
|
||||
|
||||
beego.Get("/", func(ctx *context.Context) {
|
||||
|
@ -2,43 +2,29 @@ package services
|
||||
|
||||
import (
|
||||
"cloud.o-forge.io/core/oc-catalog/conf"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
func Init() {
|
||||
// Discoveryinit() //First init DC name
|
||||
|
||||
config := conf.GetConfig()
|
||||
|
||||
var DBpoint string
|
||||
var DC_NAME string
|
||||
var err error
|
||||
|
||||
DC_NAME = config.DCNAME
|
||||
|
||||
if len(DC_NAME) == 0 {
|
||||
logs.Critical("DC_NAME URI error: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
DBpoint = config.DBPOINT
|
||||
|
||||
if len(DBpoint) == 0 {
|
||||
logs.Critical("DBPOINT URI error: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
// var DBpoint string
|
||||
// var err error
|
||||
|
||||
DCName := conf.GetConfig().DCNAME
|
||||
DBPoint := conf.GetConfig().DBPOINT
|
||||
|
||||
// DBpoint = os.Getenv("DOCKER_DBPOINT")
|
||||
// if len(DBpoint) == 0 {
|
||||
// DBpoint, err = beego.AppConfig.String("DBPOINT")
|
||||
// if err != nil {
|
||||
// logs.Critical("DBPOINT URI error: %v", err)
|
||||
// panic(err)
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
logs.Debug("connecting to datacenter db : " + DC_NAME + "-" + DBpoint)
|
||||
Mongoinit(DC_NAME + "-" + DBpoint)
|
||||
// Mongoinit(DC_NAME + "-" + DBpoint)
|
||||
Mongoinit(DCName + "-" + DBPoint )
|
||||
// Mongoinit("beego-demo")
|
||||
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ func Mongoinit(DBname string) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
logs.Info("Connecting mongo client to db %v", DBname)
|
||||
mngoDB = mngoClient.Database(DBname)
|
||||
|
||||
MngoCollData = mngoDB.Collection(MngoNamesCollection.DATA)
|
||||
|
Loading…
Reference in New Issue
Block a user