Commit 8ae8c97a authored by Lee Brown's avatar Lee Brown

Fixed web-app redirects

parent 6188b05b
......@@ -78,7 +78,7 @@ webapi:deploy:dev:
- dev-web-api
dependencies:
- 'webapi:build:dev'
# - 'db:migrate:dev'
- 'db:migrate:dev'
variables:
TARGET_ENV: 'dev'
SERVICE: 'web-api'
......@@ -92,7 +92,6 @@ webapi:deploy:dev:
#ddlogscollector:deploy:stage:
# <<: *deploy_stage_tmpl
# variables:
......
This diff is collapsed.
......@@ -44,7 +44,6 @@ func (c *Check) Health(ctx context.Context, w http.ResponseWriter, r *http.Reque
// Ping validates the service is ready to accept requests.
func (c *Check) Ping(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {
status := "pong"
return web.RespondText(ctx, w, status, http.StatusOK)
......
......@@ -79,7 +79,7 @@ func main() {
var cfg struct {
Env string `default:"dev" envconfig:"ENV"`
HTTP struct {
Host string `default:"0.0.0.0:3000" envconfig:"HOST"`
Host string `default:"0.0.0.0:3001" envconfig:"HOST"`
ReadTimeout time.Duration `default:"10s" envconfig:"READ_TIMEOUT"`
WriteTimeout time.Duration `default:"10s" envconfig:"WRITE_TIMEOUT"`
}
......@@ -369,7 +369,7 @@ func main() {
var serviceMiddlewares []web.Middleware
// Init redirect middleware to ensure all requests go to the primary domain contained in the base URL.
if primaryServiceHost != "127.0.0.0" && primaryServiceHost != "localhost" {
if primaryServiceHost != "127.0.0.1" && primaryServiceHost != "localhost" {
redirect := mid.DomainNameRedirect(mid.DomainNameRedirectConfig{
RedirectConfig: mid.RedirectConfig{
Code: http.StatusMovedPermanently,
......
......@@ -6,6 +6,7 @@ import (
"encoding/json"
"expvar"
"fmt"
"geeks-accelerator/oss/saas-starter-kit/internal/mid"
"html/template"
"log"
"net"
......@@ -21,7 +22,6 @@ import (
"time"
"geeks-accelerator/oss/saas-starter-kit/cmd/web-app/handlers"
"geeks-accelerator/oss/saas-starter-kit/internal/mid"
"geeks-accelerator/oss/saas-starter-kit/internal/platform/devops"
"geeks-accelerator/oss/saas-starter-kit/internal/platform/flag"
img_resize "geeks-accelerator/oss/saas-starter-kit/internal/platform/img-resize"
......@@ -347,7 +347,7 @@ func main() {
var serviceMiddlewares []web.Middleware
// Init redirect middleware to ensure all requests go to the primary domain contained in the base URL.
if primaryServiceHost != "127.0.0.0" && primaryServiceHost != "localhost" {
if primaryServiceHost != "127.0.0.1" && primaryServiceHost != "localhost" {
redirect := mid.DomainNameRedirect(mid.DomainNameRedirectConfig{
RedirectConfig: mid.RedirectConfig{
Code: http.StatusMovedPermanently,
......@@ -555,7 +555,7 @@ func main() {
// global variables exposed for rendering of responses with templates
gvd := map[string]interface{}{
"_App": map[string]interface{}{
"_Service": map[string]interface{}{
"ENV": cfg.Env,
"BuildInfo": cfg.BuildInfo,
"BuildVersion": build,
......
......@@ -30,7 +30,7 @@
<!-- footer -->
<!-- ============================================================== -->
<footer class="footer">
© 2019 Keeni Space<br/>
© 2019 Geeks Accelerator<br/>
{{ template "partials/buildinfo" . }}
</footer>
......
{{ define "partials/buildinfo" }}
<p style="{{if eq ._Site.ENV "prod"}}display: none;{{end}}">
{{if ne ._Site.BuildInfo.CiCommitTag ""}}
Tag: {{ ._Site.BuildInfo.CiCommitRefName }}@{{ ._Site.BuildInfo.CiCommitSha }}<br/>
<p style="{{if eq ._Service.ENV "prod"}}display: none;{{end}}">
{{if ne ._Service.BuildInfo.CiCommitTag ""}}
Tag: {{ ._Service.BuildInfo.CiCommitRefName }}@{{ ._Service.BuildInfo.CiCommitSha }}<br/>
{{else}}
Branch: {{ ._Site.BuildInfo.CiCommitRefName }}@{{ ._Site.BuildInfo.CiCommitSha }}<br/>
Branch: {{ ._Service.BuildInfo.CiCommitRefName }}@{{ ._Service.BuildInfo.CiCommitSha }}<br/>
{{end}}
{{if ne ._Site.ENV "prod"}}
Commit: {{ ._Site.BuildInfo.CiCommitTitle }}
{{if ne ._Site.BuildInfo.CiJobId ""}}
Job: <a href="{{ ._Site.BuildInfo.CiJobUrl }}" target="_blank">{{ ._Site.BuildInfo.CiJobId }}</a>
{{if ne ._Service.ENV "prod"}}
Commit: {{ ._Service.BuildInfo.CiCommitTitle }}
{{if ne ._Service.BuildInfo.CiJobId ""}}
Job: <a href="{{ ._Service.BuildInfo.CiJobUrl }}" target="_blank">{{ ._Service.BuildInfo.CiJobId }}</a>
{{end}}
{{if ne ._Site.BuildInfo.CiPipelineId ""}}
Pipeline: <a href="{{ ._Site.BuildInfo.CiPipelineUrl }}" target="_blank">{{ ._Site.BuildInfo.CiPipelineId }}</a>
{{if ne ._Service.BuildInfo.CiPipelineId ""}}
Pipeline: <a href="{{ ._Service.BuildInfo.CiPipelineUrl }}" target="_blank">{{ ._Service.BuildInfo.CiPipelineId }}</a>
{{end}}
{{end}}
</p>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment