Skip to content

Commit 25e12bc

Browse files
authored
Merge pull request #76 from epochtalk/fix-api-key
Fix api key
2 parents 9afbcd7 + 7cfb761 commit 25e12bc

File tree

6 files changed

+56
-41
lines changed

6 files changed

+56
-41
lines changed

data/nginx-vue/conf.d/default.conf

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
#access_log /var/log/nginx/host.access.log main;
6+
7+
location / {
8+
root /usr/share/nginx/html;
9+
index index.html index.htm;
10+
}
11+
12+
#error_page 404 /404.html;
13+
14+
# redirect server error pages to the static page /50x.html
15+
#
16+
error_page 500 502 503 504 /50x.html;
17+
error_page 404 =200 /index.html;
18+
location = /50x.html {
19+
root /usr/share/nginx/html;
20+
}
21+
22+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
23+
#
24+
#location ~ \.php$ {
25+
# proxy_pass http://127.0.0.1;
26+
#}
27+
28+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
29+
#
30+
#location ~ \.php$ {
31+
# root html;
32+
# fastcgi_pass 127.0.0.1:9000;
33+
# fastcgi_index index.php;
34+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
35+
# include fastcgi_params;
36+
#}
37+
38+
# deny access to .htaccess files, if Apache's document root
39+
# concurs with nginx's one
40+
#
41+
#location ~ /\.ht {
42+
# deny all;
43+
#}
44+
}

docker-compose.yml

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,7 @@ services:
44
build: .
55
ports:
66
- "80:80"
7-
links:
8-
- epochtalk
9-
environment:
10-
BASE_URL: "http://localhost:8080"
11-
epochtalk:
12-
image: quay.io/epochtalk/epochtalk:ui-refactor-2020
13-
ports:
14-
- "8080:8080"
15-
- "23958:23958"
16-
depends_on:
17-
- redis
18-
- postgres
19-
- epoch
20-
links:
21-
- redis
22-
- postgres
237
env_file:
24-
- epochtalk-docker.env
25-
epoch:
26-
image: quay.io/epochtalk/epoch:v1.14.0
27-
depends_on:
28-
- postgres
29-
links:
30-
- postgres
31-
environment:
32-
MIX_ENV: prod
33-
DATABASE_USER: docker
34-
DATABASE_PASSWORD: docker
35-
DATABASE_NAME: epochtalk
36-
DATABASE_HOST: postgres
37-
redis:
38-
image: redis:4.0.1
39-
user: redis
40-
postgres:
41-
image: postgres:11.1
42-
environment:
43-
POSTGRES_USER: docker
44-
POSTGRES_PASSWORD: docker
8+
- epochtalk-vue.env
459
volumes:
46-
- ./db:/var/lib/postgresql/data
10+
- ./data/nginx-vue/conf.d:/etc/nginx/conf.d

example.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# When adding a new env variable,
2+
# make sure to add an entry to:
3+
# src/config.json (dev)
4+
# and
5+
# src/docker-config.json (prod)
16
VUE_APP_BACKEND_URL=http://localhost:4000
27
VUE_APP_OLD_BACKEND_URL=http://localhost:8080
38
VUE_APP_API_KEY=ABC123

src/api/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const $axios2 = axios.create({
1818
const $auth = localStorageCache(0, 'app').get('auth')
1919
const initUser = $auth ? $auth.data : undefined
2020
if (initUser) { $axios2.defaults.headers.common['Authorization'] = `BEARER ${initUser.token}` }
21-
$axios2.defaults.headers.common['api-key'] = 'NB/zpr4xwTT0icF84pp8E0Tu5T+bc+gGkZ6twZT+XGEU3TkX+S7cTJ6GckLJEztx'
21+
$axios2.defaults.headers.common['api-key'] = process.env.VUE_APP_API_KEY || config.VUE_APP_API_KEY
2222

2323
/* provided methods */
2424
const $http = (path, opts, handleErrors) => {

src/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"VUE_APP_OLD_BACKEND_URL": "http://localhost:8080",
3-
"VUE_APP_BACKEND_URL": "http://localhost:4000"
3+
"VUE_APP_BACKEND_URL": "http://localhost:4000",
4+
"VUE_APP_API_KEY": "1234"
45
}

src/docker-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"VUE_APP_OLD_BACKEND_URL": "$VUE_APP_OLD_BACKEND_URL",
3-
"VUE_APP_BACKEND_URL": "$VUE_APP_BACKEND_URL"
3+
"VUE_APP_BACKEND_URL": "$VUE_APP_BACKEND_URL",
4+
"VUE_APP_API_KEY": "$VUE_APP_API_KEY"
45
}

0 commit comments

Comments
 (0)