Skip to content

Commit 40e7a77

Browse files
committed
add environment variables
1 parent 26747f8 commit 40e7a77

File tree

6 files changed

+56
-1
lines changed

6 files changed

+56
-1
lines changed

App/Config/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
This directory contains config with environment variables.
2+
The directory ``environment`` contains 3 files :
3+
- ``dev.config`` : contains development environment variables
4+
- ``production.config`` : contains production environment variables
5+
- ``staging.config`` : contains beta tests environment variables
6+
7+
####Usage
8+
```
9+
import config from 'App/Config/config'
10+
11+
...
12+
let uri = config.API_URL
13+
...
14+
```

App/Config/config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const config = {
2+
APP_ID: 'com.tcm.boilerplate',
3+
APP_ENV: 'development',
4+
APP_VERSION: '0.1.0',
5+
APP_BUILD: '1',
6+
API_URL: 'https://query.yahooapis.com/v1/public/',
7+
API_PREFIX: 'api',
8+
}
9+
10+
export default config

App/Config/environment/dev.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const config = {
2+
APP_ID: 'com.tcm.boilerplate',
3+
APP_ENV: 'development',
4+
APP_VERSION: '0.1.0',
5+
APP_BUILD: '1',
6+
API_URL: 'https://query.yahooapis.com/v1/public/',
7+
API_PREFIX: 'api',
8+
}
9+
10+
export default config
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const config = {
2+
APP_ID: 'com.tcm.boilerplate',
3+
APP_ENV: 'production',
4+
APP_VERSION: '0.1.0',
5+
APP_BUILD: '1',
6+
API_URL: 'https://query.yahooapis.com/v1/public/',
7+
API_PREFIX: 'api',
8+
}
9+
10+
export default config
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const config = {
2+
APP_ID: 'com.tcm.boilerplate',
3+
APP_ENV: 'staging',
4+
APP_VERSION: '0.1.0',
5+
APP_BUILD: '1',
6+
API_URL: 'https://query.yahooapis.com/v1/public/',
7+
API_PREFIX: 'api',
8+
}
9+
10+
export default config

App/Service/WeatherService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { create } from 'apisauce'
2+
import config from 'App/Config/config'
23

34
const weatherApiClient = create({
4-
baseURL: 'https://query.yahooapis.com/v1/public/',
5+
baseURL: config.API_URL,
56
headers: {
67
Accept: 'application/json',
78
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)