Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit e3f8fc2

Browse files
author
Brian Caffey
committed
refactored quasar config
1 parent 11b2204 commit e3f8fc2

File tree

10 files changed

+108
-23
lines changed

10 files changed

+108
-23
lines changed

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ DJANGO_EMAIL_PORT=1025
2121

2222
# for local development, change ``localhost`` to your
2323
# local IP, such as ``196.168.1.16``
24-
LOCAL_IP_ADDRESS=localhost
24+
DOMAIN_NAME=localhost

docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ services:
6969
- db
7070
environment:
7171
- CHOKIDAR_USEPOLLING=true
72-
- LOCAL_IP_ADDRESS=${LOCAL_IP_ADDRESS}
72+
- GITHUB_KEY=${GITHUB_KEY}
73+
- GOOGLE_KEY=${GOOGLE_KEY}
74+
- HTTP_PROTOCOL=http
75+
- WS_PROTOCOL=ws
76+
- DOMAIN_NAME=${DOMAIN_NAME}
7377
restart: "no"
7478

7579
backend: &backend

quasar/quasar.conf.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,28 @@ module.exports = function(ctx) {
5656
build: {
5757
env: ctx.dev
5858
? {
59-
API_URL: `"http://${process.env.LOCAL_IP_ADDRESS}"`,
60-
WS_PING_PONG: `"ws://${process.env.LOCAL_IP_ADDRESS}/ws/ping-pong/"`
59+
API_URL: JSON.stringify(
60+
`${process.env.HTTP_PROTOCOL}://${process.env.DOMAIN_NAME}`
61+
),
62+
WS_PING_PONG: JSON.stringify(
63+
`${process.env.WS_PROTOCOL}://${
64+
process.env.LOCAL_IP_ADDRESS
65+
}/ws/ping-pong/`
66+
),
67+
GITHUB_KEY: JSON.stringify(process.env.GITHUB_KEY),
68+
GOOGLE_KEY: JSON.stringify(process.env.GOOGLE_KEY)
6169
}
6270
: {
63-
API_URL: `"http://nginx"`,
64-
WS_PING_PONG: `"ws://nginx/ws/ping-pong/"`
71+
API_URL: JSON.stringify(
72+
`${process.env.HTTP_PROTOCOL}://${process.env.DOMAIN_NAME}`
73+
),
74+
WS_PING_PONG: JSON.stringify(
75+
`${process.env.WS_PROTOCOL}://${
76+
process.env.LOCAL_IP_ADDRESS
77+
}/ws/ping-pong/`
78+
),
79+
GITHUB_KEY: JSON.stringify(process.env.GITHUB_KEY),
80+
GOOGLE_KEY: JSON.stringify(process.env.GOOGLE_KEY)
6581
},
6682
scopeHoisting: true,
6783
useNotifier: false,

quasar/src/components/AuthModal.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@ export default {
6969
data() {
7070
return {
7171
tab: "login",
72-
params: {
73-
client_id: "d6639d522598d6bf20f4",
74-
redirect_uri: "http://localhost/auth/github/callback",
75-
login: "",
76-
scope: "user",
77-
state: "eworifjeovivoiej"
78-
},
79-
githuboauth2: "https://github.com/login/oauth/authorize",
8072
email: process.env.NODE_ENV === "production" ? "" : "admin@company.com",
8173
password: process.env.NODE_ENV === "production" ? "" : "password"
8274
};

quasar/src/layouts/primary/MainLeftDrawer.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868
caption="Test redis connection"
6969
/>
7070
</q-expansion-item>
71+
<left-menu-link
72+
label="Environment Variables"
73+
to="/debug/environment-variables"
74+
icon="offline_bolt"
75+
caption="Displays Environment Variables for Debug Purposes"
76+
/>
7177
</q-list>
7278
</q-drawer>
7379
</div>

quasar/src/pages/Auth/Callback.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
2-
<base-page>Logging in with GitHub...</base-page>
2+
<base-page>Logging in with {{ provider }}...</base-page>
33
</template>
44

55
<script>
66
import * as Cookies from "js-cookie";
77
import axios from "axios";
88
export default {
99
methods: {
10-
githubAuth() {
10+
handleOauthCallback() {
1111
const provider = this.$route.params.provider;
1212
axios
1313
.post(`/api/social/${provider}/`, { code: this.$route.query.code })
@@ -19,7 +19,12 @@ export default {
1919
}
2020
},
2121
created() {
22-
this.githubAuth();
22+
this.handleOauthCallback();
23+
},
24+
computed: {
25+
provider() {
26+
return this.$route.params.provider;
27+
}
2328
}
2429
};
2530
</script>

quasar/src/pages/Environment.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<base-page>
3+
<p v-for="(value, key) in env" :key="key">{{ key }}: {{ value }}</p>
4+
</base-page>
5+
</template>
6+
7+
<script>
8+
export default {
9+
created() {
10+
console.log(JSON.stringify(process.env));
11+
},
12+
data() {
13+
return {
14+
env: process.env
15+
};
16+
}
17+
};
18+
</script>
19+
20+
<style lang="scss" scoped></style>

quasar/src/router/routes.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ const routes = [
3030
component: () => import("layouts/MainLayout.vue"),
3131
children: [
3232
{
33-
path: "auth/github/callback",
34-
component: () => import("pages/Auth/GitHub.vue")
35-
},
36-
{
37-
path: "auth/google/callback",
38-
component: () => import("pages/Auth/Google.vue")
33+
path: "auth/:provider/callback",
34+
component: () => import("pages/Auth/Callback.vue")
3935
},
4036
{
4137
path: "",
@@ -58,6 +54,10 @@ const routes = [
5854
path: "services",
5955
component: () => import("pages/Services/index.vue")
6056
},
57+
{
58+
path: "debug/environment-variables",
59+
component: () => import("pages/Environment.vue")
60+
},
6161
{
6262
path: "examples/",
6363
beforeEnter: ifAuthenticated,

quasar/src/store/social.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import oauth from "../utils/oauth";
2+
3+
const state = {
4+
oauth
5+
};
6+
7+
const getters = {
8+
oauthUrl: () => {
9+
return provider => state.oauth[provider].sender;
10+
},
11+
getProfile: s => s.status,
12+
getUrl: s => s.status
13+
};
14+
15+
const actions = {};
16+
17+
const mutations = {};
18+
19+
export default {
20+
state,
21+
getters,
22+
actions,
23+
mutations
24+
};

quasar/src/utils/oauth.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const protocol = process.env.NODE_ENV === "production" ? "https://" : "http://";
2+
const url = process.env.SITE_URL;
3+
const baseUrl = protocol + url;
4+
5+
const oauth = {
6+
github: {
7+
url: "https://github.com/oauth",
8+
params: {
9+
client_id: process.env.GITHUB_KEY,
10+
redirect_uri: `${baseUrl}/auth/github/callback`,
11+
login: "",
12+
scope: "user",
13+
state: "eworifjeovivoiej"
14+
}
15+
}
16+
};
17+
18+
export default oauth;

0 commit comments

Comments
 (0)