Browse Source

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

Skylsmoi 6 years ago
parent
commit
32a947ca5f

+ 1 - 0
frontend/.gitignore View File

4
 dist/asset/tracim.app.entry.js
4
 dist/asset/tracim.app.entry.js
5
 dist/asset/tracim.vendor.bundle.js
5
 dist/asset/tracim.vendor.bundle.js
6
 dist/asset/images/
6
 dist/asset/images/
7
+configEnv.js

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

1
+export const apiUrl = 'http://localhost:6543/api/v2'

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

1
+import { apiUrl as configApiUrl } from '../configEnv.js'
2
+
1
 export const FETCH_CONFIG = {
3
 export const FETCH_CONFIG = {
2
   headers: {
4
   headers: {
3
     'Accept': 'application/json',
5
     'Accept': 'application/json',
4
     'Content-Type': 'application/json'
6
     'Content-Type': 'application/json'
5
   },
7
   },
6
-  apiUrl: 'http://localhost:6543/api/v2',
8
+  apiUrl: configApiUrl,
7
   mockApiUrl: 'http://localhost:3001' // @todo: better to use one url only and use proxy on mock api to point to real api (if implemented)
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
   npm i
84
   npm i
85
   log "npm link tracim_frontend_lib"
85
   log "npm link tracim_frontend_lib"
86
   npm link tracim_frontend_lib
86
   npm link tracim_frontend_lib
87
+  log "cp config.js.sample config.js"
88
+  cp configEnv.js.sample configEnv.js
87
 )
89
 )