adjustment
This commit is contained in:
parent
d76473bb0f
commit
e45f7c2bf8
11
Makefile
11
Makefile
@ -6,8 +6,13 @@ build: clean
|
||||
run:
|
||||
bee run -gendoc=true -downdoc=true
|
||||
|
||||
dev:
|
||||
bee generate routers && HTTPPORT=8091 bee run -gendoc=true -downdoc=true
|
||||
purge:
|
||||
lsof -t -i:8091 | xargs kill | true
|
||||
|
||||
run-dev:
|
||||
bee generate routers && bee run -gendoc=true -downdoc=true -runmode=prod
|
||||
|
||||
dev: purge run-dev
|
||||
|
||||
debug:
|
||||
bee run -downdebug -gendebug
|
||||
@ -27,4 +32,4 @@ publish-registry:
|
||||
|
||||
all: docker publish-kind publish-registry
|
||||
|
||||
.PHONY: build run clean docker publish-kind publish-registry
|
||||
.PHONY: build run clean docker publish-kind publish-registry
|
||||
|
@ -15,7 +15,10 @@ type VersionController struct {
|
||||
// @Success 200
|
||||
// @router / [get]
|
||||
func (c *VersionController) GetAll() {
|
||||
c.Data["json"] = map[string]string{"version": "1"}
|
||||
c.Data["json"] = map[string]string{
|
||||
"service": "oc-shared",
|
||||
"version": "1",
|
||||
}
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
mongo:
|
||||
image: 'mongo:latest'
|
||||
networks:
|
||||
- catalog
|
||||
ports:
|
||||
- 27017:27017
|
||||
container_name: mongo
|
||||
volumes:
|
||||
- oc-catalog-data:/data/db
|
||||
- oc-catalog-data:/data/configdb
|
||||
|
||||
mongo-express:
|
||||
image: "mongo-express:latest"
|
||||
restart: always
|
||||
depends_on:
|
||||
- mongo
|
||||
networks:
|
||||
- catalog
|
||||
ports:
|
||||
- 8081:8081
|
||||
environment:
|
||||
- ME_CONFIG_BASICAUTH_USERNAME=test
|
||||
- ME_CONFIG_BASICAUTH_PASSWORD=test
|
||||
|
||||
volumes:
|
||||
oc-catalog-data:
|
||||
|
||||
networks:
|
||||
catalog:
|
||||
external: true
|
||||
# name: catalog
|
@ -18,8 +18,8 @@ services:
|
||||
- "traefik.http.services.shared.loadbalancer.server.port=8080"
|
||||
- "traefik.http.middlewares.shared.forwardauth.address=http://oc-auth:8080/oc/forward"
|
||||
networks:
|
||||
- catalog
|
||||
- oc
|
||||
|
||||
networks:
|
||||
catalog:
|
||||
oc:
|
||||
external: true
|
19
main.go
19
main.go
@ -11,8 +11,26 @@ import (
|
||||
const appname = "oc-shared"
|
||||
|
||||
func main() {
|
||||
// Init the oc-lib
|
||||
// Init the oc-lib
|
||||
oclib.Init(appname)
|
||||
|
||||
// Load the right config file
|
||||
o := oclib.GetConfLoader()
|
||||
|
||||
// feed the library with the loaded config
|
||||
oclib.SetConfig(
|
||||
o.GetStringDefault("MONGO_URL", "mongodb://127.0.0.1:27017"),
|
||||
o.GetStringDefault("MONGO_DATABASE", "DC_myDC"),
|
||||
o.GetStringDefault("NATS_URL", "nats://localhost:4222"),
|
||||
o.GetStringDefault("LOKI_URL", ""),
|
||||
o.GetStringDefault("LOG_LEVEL", "info"),
|
||||
)
|
||||
// Beego init
|
||||
beego.BConfig.AppName = appname
|
||||
beego.BConfig.Listen.HTTPPort = o.GetIntDefault("port", 8080)
|
||||
beego.BConfig.WebConfig.DirectoryIndex = true
|
||||
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
|
||||
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
|
||||
AllowAllOrigins: true,
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
@ -20,5 +38,6 @@ func main() {
|
||||
ExposeHeaders: []string{"Content-Length", "Content-Type"},
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
|
||||
beego.Run()
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"port":8080,
|
||||
"port":8091,
|
||||
"MONGO_URL":"mongodb://localhost:27017/",
|
||||
"MONGO_DATABASE":"DC_myDC"
|
||||
}
|
Loading…
Reference in New Issue
Block a user