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

Commit 87748c8

Browse files
committed
use relative path for api url, refactor ws and http protocol variables
1 parent 883c8fd commit 87748c8

File tree

10 files changed

+55
-69
lines changed

10 files changed

+55
-69
lines changed

docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ services:
7373
- GITHUB_KEY=${GITHUB_KEY}
7474
- GOOGLE_OAUTH2_KEY=${GOOGLE_OAUTH2_KEY}
7575
- FACEBOOK_KEY=${FACEBOOK_KEY}
76-
- HTTP_PROTOCOL=http
77-
- WS_PROTOCOL=ws
78-
- DOMAIN_NAME=${DOMAIN_NAME}
76+
- FULL_DOMAIN_NAME=${DOMAIN_NAME}
7977
restart: "no"
8078

8179
backend: &backend
@@ -182,7 +180,7 @@ services:
182180
PGADMIN_DEFAULT_EMAIL: pgadmin4@pgadmin.org
183181
PGADMIN_DEFAULT_PASSWORD: admin
184182
volumes:
185-
- pgadmin:/root/.pgadmin
183+
- pgadmin:/root/.pgadmin
186184
ports:
187185
- "5050:80"
188186
depends_on:

gitlab-ci/aws/cdk.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# and to deploy changes to the frontend and backend
33

44
variables:
5-
ECR_BASE_URL: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com
65
ENVIRONMENT: dev
76

87
.Build Quasar PWA Assets:
@@ -11,11 +10,9 @@ variables:
1110
only:
1211
- master
1312
variables:
14-
DOMAIN_NAME: ${ENVIRONMENT}.${DOMAIN_NAME}
13+
FULL_DOMAIN_NAME: ${ENVIRONMENT}.${DOMAIN_NAME}
1514
GOOGLE_OAUTH2_KEY: google123
1615
GITHUB_KEY: github123
17-
WS_PROTOCOL: wss
18-
HTTP_PROTOCOL: https
1916
artifacts:
2017
paths:
2118
- quasar/dist/pwa

quasar/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"highcharts": "8.1.0",
2525
"highcharts-vue": "1.3.5",
2626
"js-cookie": "2.2.1",
27+
"prettier": "^2.0.5",
2728
"quasar": "1.10.5",
2829
"vue-apollo": "3.0.3",
2930
"vue-i18n": "8.17.4",

quasar/quasar.conf.js

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Configuration for your app
22
// https://quasar.dev/quasar-cli/quasar-conf-js
33

4-
module.exports = function(ctx) {
4+
module.exports = function (ctx) {
55
return {
66
// app boot file (/src/boot)
77
// --> boot files are part of "main.js"
@@ -16,7 +16,7 @@ module.exports = function(ctx) {
1616
// "roboto-font-latin-ext", // this or either "roboto-font", NEVER both!
1717

1818
"roboto-font", // optional, you are not bound to it
19-
"material-icons" // optional, you are not bound to it
19+
"material-icons", // optional, you are not bound to it
2020
],
2121

2222
framework: {
@@ -66,13 +66,13 @@ module.exports = function(ctx) {
6666
"QDate",
6767
"QPopupProxy",
6868
"QFile",
69-
"QCardSection"
69+
"QCardSection",
7070
],
7171

7272
directives: ["Ripple", "ClosePopup"],
7373

7474
// Quasar plugins
75-
plugins: ["Notify", "Cookies"]
75+
plugins: ["Notify", "Cookies"],
7676
},
7777

7878
// env: {
@@ -83,26 +83,18 @@ module.exports = function(ctx) {
8383
build: {
8484
env: ctx.dev
8585
? {
86-
API_URL: JSON.stringify(
87-
`${process.env.HTTP_PROTOCOL}://${process.env.DOMAIN_NAME}`
88-
),
89-
WS_PING_PONG: JSON.stringify(
90-
`${process.env.WS_PROTOCOL}://${process.env.DOMAIN_NAME}/ws/ping-pong/`
91-
),
86+
API_URL: JSON.stringify(`http://${process.env.FULL_DOMAIN_NAME}`),
87+
WS_URL: JSON.stringify(`ws://${process.env.FULL_DOMAIN_NAME}`),
9288
GITHUB_KEY: JSON.stringify(process.env.GITHUB_KEY),
9389
GOOGLE_OAUTH2_KEY: JSON.stringify(process.env.GOOGLE_OAUTH2_KEY),
94-
FACEBOOK_KEY: JSON.stringify(process.env.FACEBOOK_KEY)
90+
FACEBOOK_KEY: JSON.stringify(process.env.FACEBOOK_KEY),
9591
}
9692
: {
97-
API_URL: JSON.stringify(
98-
`${process.env.HTTP_PROTOCOL}://${process.env.DOMAIN_NAME}`
99-
),
100-
WS_PING_PONG: JSON.stringify(
101-
`${process.env.WS_PROTOCOL}://${process.env.DOMAIN_NAME}/ws/ping-pong/`
102-
),
93+
API_URL: JSON.stringify(`https://${process.env.FULL_DOMAIN_NAME}`),
94+
WS_URL: JSON.stringify(`$wss://${process.env.FULL_DOMAIN_NAME}`),
10395
GITHUB_KEY: JSON.stringify(process.env.GITHUB_KEY),
10496
GOOGLE_OAUTH2_KEY: JSON.stringify(process.env.GOOGLE_OAUTH2_KEY),
105-
FACEBOOK_KEY: JSON.stringify(process.env.FACEBOOK_KEY)
97+
FACEBOOK_KEY: JSON.stringify(process.env.FACEBOOK_KEY),
10698
},
10799
scopeHoisting: true,
108100
useNotifier: false,
@@ -119,28 +111,28 @@ module.exports = function(ctx) {
119111
loader: "eslint-loader",
120112
exclude: /node_modules/,
121113
options: {
122-
formatter: require("eslint").CLIEngine.getFormatter("stylish")
123-
}
114+
formatter: require("eslint").CLIEngine.getFormatter("stylish"),
115+
},
124116
});
125-
}
117+
},
126118
},
127119

128120
devServer: {
129121
headers: {
130122
"Access-Control-Allow-Origin": "*",
131123
"Access-Control-Allow-Headers":
132-
"Origin, X-Requested-With, Content-Type, Accept"
124+
"Origin, X-Requested-With, Content-Type, Accept",
133125
},
134126
// https: true,
135127
port: 8080,
136-
open: true // opens browser window automatically
128+
open: true, // opens browser window automatically
137129
},
138130

139131
// animations: "all", // --- includes all animations
140132
animations: "all", //[],
141133

142134
ssr: {
143-
pwa: false
135+
pwa: false,
144136
},
145137

146138
pwa: {
@@ -158,30 +150,30 @@ module.exports = function(ctx) {
158150
{
159151
src: "statics/icons/icon-128x128.png",
160152
sizes: "128x128",
161-
type: "image/png"
153+
type: "image/png",
162154
},
163155
{
164156
src: "statics/icons/icon-192x192.png",
165157
sizes: "192x192",
166-
type: "image/png"
158+
type: "image/png",
167159
},
168160
{
169161
src: "statics/icons/icon-256x256.png",
170162
sizes: "256x256",
171-
type: "image/png"
163+
type: "image/png",
172164
},
173165
{
174166
src: "statics/icons/icon-384x384.png",
175167
sizes: "384x384",
176-
type: "image/png"
168+
type: "image/png",
177169
},
178170
{
179171
src: "statics/icons/icon-512x512.png",
180172
sizes: "512x512",
181-
type: "image/png"
182-
}
183-
]
184-
}
173+
type: "image/png",
174+
},
175+
],
176+
},
185177
},
186178

187179
cordova: {
@@ -211,7 +203,7 @@ module.exports = function(ctx) {
211203
builder: {
212204
// https://www.electron.build/configuration/configuration
213205
// appId: "quasarfrontend"
214-
}
215-
}
206+
},
207+
},
216208
};
217209
};

quasar/src/boot/apollo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { InMemoryCache } from "apollo-cache-inmemory";
77

88
// HTTP connection to the API
99
const httpLink = createHttpLink({
10-
uri: `${process.env.API_URL}/graphql/`
10+
uri: `/graphql/`,
1111
});
1212

1313
// Cache implementation
@@ -22,18 +22,18 @@ export default ({ app, Vue, store }) => {
2222
return {
2323
headers: {
2424
...headers,
25-
authorization
26-
}
25+
authorization,
26+
},
2727
};
2828
});
2929

3030
const apolloClient = new ApolloClient({
3131
link: authLink.concat(httpLink),
32-
cache
32+
cache,
3333
});
3434

3535
const apolloProvider = new VueApollo({
36-
defaultClient: apolloClient
36+
defaultClient: apolloClient,
3737
});
3838

3939
Vue.use(VueApollo);

quasar/src/boot/axios.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import axios from "axios";
22

33
export default async ({ Vue, store, router }) => {
4-
const apiCall = axios.create({
5-
baseURL: process.env.API_URL,
6-
});
4+
const apiCall = axios.create();
75

86
apiCall.interceptors.request.use(
97
(config) => {

quasar/src/boot/websockets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import VueNativeSock from "vue-native-websocket";
22

33
export default ({ store, Vue }) => {
44
// something to do
5-
Vue.use(VueNativeSock, process.env.WS_PING_PONG, {
5+
Vue.use(VueNativeSock, process.env.WS_URL, {
66
store,
77
format: "json",
88
connectManually: true,
99
reconnection: true, // (Boolean) whether to reconnect automatically (false)
1010
reconnectionAttempts: 5, // (Number) number of reconnection attempts before giving up (Infinity),
11-
reconnectionDelay: 3000 // (Number) how long to initially wait before attempting a new (1000)
11+
reconnectionDelay: 3000, // (Number) how long to initially wait before attempting a new (1000)
1212
});
1313
};

quasar/src/pages/Examples/Websockets.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
export default {
3131
data() {
3232
return {
33-
wsUrl: process.env.WS_PING_PONG,
33+
wsUrl: `${process.env.WS_URL}/ws/ping-pong/`,
3434
pongs: [],
35-
showLatency: false
35+
showLatency: false,
3636
};
3737
},
3838
created() {
3939
this.$connect(this.wsUrl, { format: "json" });
40-
this.$socket.onmessage = i => {
40+
this.$socket.onmessage = (i) => {
4141
const data = JSON.parse(i["data"]);
4242
data.vue_recv_pong = new Date().getTime();
4343
this.pongs.unshift(data);
@@ -49,14 +49,14 @@ export default {
4949
JSON.stringify({
5050
message: "ping",
5151
sender: 1,
52-
ts: new Date().getTime()
52+
ts: new Date().getTime(),
5353
})
5454
);
55-
}
55+
},
5656
},
5757
destroyed() {
5858
this.$disconnect();
59-
}
59+
},
6060
};
6161
</script>
6262

quasar/src/store/social/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import buildURL from "axios/lib/helpers/buildURL";
22
import oauth from "../../utils/oauth";
33

44
const state = {
5-
oauth
5+
oauth,
66
};
77

88
const getters = {
99
oauthUrl: () => {
10-
return provider => {
10+
return (provider) => {
1111
const url = state.oauth[provider].url;
1212
const params = state.oauth[provider].params;
1313

1414
return buildURL(url, params);
1515
};
16-
}
16+
},
1717
};
1818

1919
const actions = {};
@@ -24,5 +24,5 @@ export default {
2424
state,
2525
getters,
2626
actions,
27-
mutations
27+
mutations,
2828
};

quasar/src/utils/oauth.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const oauth = {
88
redirect_uri: `${url}/auth/github/callback`,
99
login: "",
1010
scope: "user",
11-
state: "eworifjeovivoiej"
12-
}
11+
state: "eworifjeovivoiej",
12+
},
1313
},
1414
"google-oauth2": {
1515
url: "https://accounts.google.com/o/oauth2/v2/auth",
@@ -20,18 +20,18 @@ const oauth = {
2020
redirect_uri: `${url}/auth/google-oauth2/callback`,
2121
state: "eworifjeovivoiej", // TODO: change these
2222
nonce: "forewijf43oirjoifj",
23-
login_hint: ""
24-
}
23+
login_hint: "",
24+
},
2525
},
2626
facebook: {
2727
url: "https://www.facebook.com/v5.0/dialog/oauth",
2828
params: {
2929
client_id: process.env.FACEBOOK_KEY,
3030
redirect_uri: `${url}/auth/facebook/callback`,
3131
state: "eworifjeovivoiej", // TODO: change these
32-
scope: "email"
33-
}
34-
}
32+
scope: "email",
33+
},
34+
},
3535
};
3636

3737
export default oauth;

0 commit comments

Comments
 (0)