Browse Source

[https://github.com/tracim/tracim/issues/825] added config js file for environment (eg. apiUrl)

Skylsmoi 5 years ago
parent
commit
32a947ca5f
4 changed files with 7 additions and 1 deletions
  1. 1 0
      frontend/.gitignore
  2. 1 0
      frontend/configEnv.js.sample
  3. 3 1
      frontend/src/helper.js
  4. 2 0
      install_frontend_dependencies.sh

+ 1 - 0
frontend/.gitignore View File

@@ -4,3 +4,4 @@ node_modules/
4 4
 dist/asset/tracim.app.entry.js
5 5
 dist/asset/tracim.vendor.bundle.js
6 6
 dist/asset/images/
7
+configEnv.js

+ 1 - 0
frontend/configEnv.js.sample View File

@@ -0,0 +1 @@
1
+export const apiUrl = 'http://localhost:6543/api/v2'

+ 3 - 1
frontend/src/helper.js View File

@@ -1,9 +1,11 @@
1
+import { apiUrl as configApiUrl } from '../configEnv.js'
2
+
1 3
 export const FETCH_CONFIG = {
2 4
   headers: {
3 5
     'Accept': 'application/json',
4 6
     'Content-Type': 'application/json'
5 7
   },
6
-  apiUrl: 'http://localhost:6543/api/v2',
8
+  apiUrl: configApiUrl,
7 9
   mockApiUrl: 'http://localhost:3001' // @todo: better to use one url only and use proxy on mock api to point to real api (if implemented)
8 10
 }
9 11
 

+ 2 - 0
install_frontend_dependencies.sh View File

@@ -84,4 +84,6 @@
84 84
   npm i
85 85
   log "npm link tracim_frontend_lib"
86 86
   npm link tracim_frontend_lib
87
+  log "cp config.js.sample config.js"
88
+  cp configEnv.js.sample configEnv.js
87 89
 )