Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Commit 45c8b24

Browse files
authored
fix OAuth callback path (#377)
use angular-cli proxy feature to proxy to backend on the same localhost port
1 parent b66e295 commit 45c8b24

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

docker-compose.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ services:
88
- 4200:4200
99
volumes:
1010
- ./src/ui:/app
11-
command: "ng serve --host 0.0.0.0"
11+
command: "ng serve --host 0.0.0.0 --proxy-config proxy.conf.json"
1212
api:
1313
tty: true
1414
build: ./dev_env/api
15-
ports:
16-
- 8080:3000
1715
volumes:
1816
- ./src/api:/go/src/github.com/kubernetes-helm/monocular/src/api
1917
# Config example file
@@ -22,11 +20,5 @@ services:
2220
- $HOME/.kube/:/root/.kube
2321
environment:
2422
- ENVIRONMENT=development
25-
redis:
26-
image: bitnami/redis:4.0
27-
environment:
28-
- ALLOW_EMPTY_PASSWORD=yes
29-
ports:
30-
- 6379:6379
3123
mongodb:
3224
image: bitnami/mongodb:3

src/api/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func GetOAuthConfig(host string) (*oauth2.Config, error) {
9999
ClientID: clientID,
100100
ClientSecret: clientSecret,
101101
Endpoint: oauth2Github.Endpoint,
102-
RedirectURL: "http://" + host + "/auth/github/callback",
102+
RedirectURL: "http://" + host + "/api/auth/github/callback",
103103
Scopes: []string{"repo"},
104104
}, nil
105105
}

src/ui/proxy.conf.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"/api": {
3+
"target": "http://api:3000",
4+
"secure": false,
5+
"pathRewrite": {
6+
"^/api": ""
7+
}
8+
}
9+
}

src/ui/src/app/shared/services/config.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ConfigService {
1515
overrides = window["monocular"]["overrides"] || {};
1616
}
1717

18-
this.backendHostname = overrides.backendHostname || "http://localhost:8080";
18+
this.backendHostname = overrides.backendHostname || "/api";
1919
this.appName = overrides.appName || "Monocular";
2020
this.releasesEnabled = overrides.releasesEnabled;
2121
}

src/ui/src/assets/js/overrides.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ window.monocular = {
44
appName: 'Monocular',
55
releasesEnabled: true,
66
tillerPortForward: true,
7-
backendHostname: 'http://localhost:8080'
7+
backendHostname: '/api'
88
}
99
};

0 commit comments

Comments
 (0)