Browse Source

Adds testing configuration for local dev

pull/8/head
Noah Pederson 2 years ago
parent
commit
b9d03cc6ab
2 changed files with 25 additions and 11 deletions
  1. +2
    -1
      .vscode/launch.json
  2. +23
    -10
      cmd/bakamoews/main.go

+ 2
- 1
.vscode/launch.json View File

@ -33,7 +33,8 @@
"MINIO_ADDR": "localhost:9000",
"MINIO_ACCESS_KEY": "QS7I194ALRWEUSE47KLZ",
"MINIO_SECRET_KEY": "UXlW3pM0RNE1qXh8Gw7ROx47e6vWvD6efEUdb059",
"MINIO_BUCKET_NAME": "koukai-local01"
"MINIO_BUCKET_NAME": "koukai-local01",
"TESTING": "true"
},
"args": [],
"showLog": true


+ 23
- 10
cmd/bakamoews/main.go View File

@ -18,6 +18,8 @@ import (
//TODO: implement **all** the web services
func main() {
TESTING := os.Getenv("TESTING")
POSTGRES_USER := os.Getenv("POSTGRES_USER")
POSTGRES_PASSWORD := os.Getenv("POSTGRES_PASSWORD")
POSTGRES_ADDR := os.Getenv("POSTGRES_ADDR")
@ -65,17 +67,28 @@ func main() {
tpk := []byte(TOKEN_PRIVATE_KEY)
r := chi.NewRouter()
r.Route("/user", func(r chi.Router) {
userserviceweb.BindHandlers(r, userService, tpk)
})
//Media service handles two entities and it's internal routes are expressive enough that I
//don't think it's necessary to add another path section
mediaserviceweb.BindHandlers(r, mediaService, tpk)
//TextService!
r.Route("/text", func(r chi.Router) {
textserviceweb.BindHandlers(r, textService, tpk)
})
bindServices := func(r chi.Router) {
r.Route("/user", func(r chi.Router) {
userserviceweb.BindHandlers(r, userService, tpk)
})
//Media service handles two entities and it's internal routes are expressive enough that I
//don't think it's necessary to add another path section
mediaserviceweb.BindHandlers(r, mediaService, tpk)
//TextService!
r.Route("/text", func(r chi.Router) {
textserviceweb.BindHandlers(r, textService, tpk)
})
}
if TESTING == "true" {
r.Route("/api", func(r chi.Router) {
bindServices(r)
})
} else {
bindServices(r)
}
log.Printf("Starting all webservices on port %d", 8080)
//Finally bind everything to the root endpoint


Loading…
Cancel
Save