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

Commit 520216a

Browse files
committed
Merge branch '29-remove-api-url-from-frontend' into 'develop'
Resolve "Remove base URL for frontend AJAX/WS request" Closes #29 See merge request verbose-equals-true/django-postgres-vue-gitlab-ecs!73
2 parents 883c8fd + b3d10e3 commit 520216a

File tree

14 files changed

+67
-93
lines changed

14 files changed

+67
-93
lines changed

backend/scripts/ci/Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ ADD backend/ /code/
1515

1616
# build stage that generates quasar assets
1717
FROM node:10-alpine as build-stage
18-
ENV HTTP_PROTOCOL http
19-
ENV WS_PROTOCOL ws
20-
ENV DOMAIN_NAME localhost:9000
18+
ENV FULL_DOMAIN_NAME localhost:9000
2119
WORKDIR /app/
2220
COPY quasar/package.json /app/
2321
RUN npm cache verify
@@ -43,9 +41,9 @@ RUN npm -v
4341

4442
# cypress dependencies
4543
RUN apt-get -qq install -y xvfb \
46-
libgtk-3-dev \
47-
libnotify-dev \
48-
libgconf-2-4 \
49-
libnss3 \
50-
libxss1 \
51-
libasound2
44+
libgtk-3-dev \
45+
libnotify-dev \
46+
libgconf-2-4 \
47+
libnss3 \
48+
libxss1 \
49+
libasound2

compose/minikube.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
version: '3.7'
1+
version: "3.7"
22

33
services:
4-
54
frontend:
65
image: frontend:2
76
build:
87
context: ../
98
dockerfile: nginx/minikube/Dockerfile
109
args:
11-
- DOMAIN_NAME=minikube.local
10+
- FULL_DOMAIN_NAME=minikube.local
1211
- GOOGLE_OAUTH2_KEY=google123
1312
- GITHUB_KEY=github123
14-
- WS_PROTOCOL=ws
15-
- HTTP_PROTOCOL=http
1613

1714
backend:
1815
image: backend:1
1916
build:
2017
context: ../backend/
2118
dockerfile: scripts/dev/Dockerfile
22-

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:

documentation/docs/topics/minikube/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,9 @@ services:
775775
context: ../
776776
dockerfile: nginx/minikube/Dockerfile
777777
args:
778-
- DOMAIN_NAME=minikube.local
778+
- FULL_DOMAIN_NAME=minikube.local
779779
- GOOGLE_OAUTH2_KEY=google123
780780
- GITHUB_KEY=github123
781-
- WS_PROTOCOL=ws
782-
- HTTP_PROTOCOL=http
783781
```
784782

785783
Make sure that your current shell has the correct environment variables set for the `DOCKER_HOST` by running:

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

nginx/minikube/Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# build stage
22
FROM node:10-alpine as build-stage
3-
ARG DOMAIN_NAME
3+
ARG FULL_DOMAIN_NAME
44
ARG GOOGLE_OAUTH2_KEY
55
ARG GITHUB_KEY
6-
ARG WS_PROTOCOL
7-
ARG HTTP_PROTOCOL
86

9-
ENV DOMAIN_NAME=${DOMAIN_NAME}
7+
ENV FULL_DOMAIN_NAME=${DOMAIN_NAME}
108
ENV GOOGLE_OAUTH2_KEY=${GOOGLE_OAUTH2_KEY}
119
ENV GITHUB_KEY=${GITHUB_KEY}
12-
ENV WS_PROTOCOL=${WS_PROTOCOL}
13-
ENV HTTP_PROTOCOL=${HTTP_PROTOCOL}
1410

1511
WORKDIR /app/
1612
COPY quasar/package.json /app/

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) => {

0 commit comments

Comments
 (0)