Skip to content

Commit 37fef59

Browse files
author
Walker Leite
committed
feat(template): fix deploy and add settings
1 parent 940559b commit 37fef59

File tree

9 files changed

+27
-11
lines changed

9 files changed

+27
-11
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ $ DEBUG=loopback npm run dev
6060

6161
## Executing built files
6262

63+
Please remember to update `server/*.production.json` files to match your enviroment.
64+
6365
```bash
6466
$ cd build
6567
$ npm run start

template/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ $ DEBUG=loopback npm run dev
4949

5050
## Executing built files
5151

52+
Please remember to update `server/*.production.json` files to match your enviroment.
53+
5254
```bash
5355
$ cd build
5456
$ npm run start

template/client/services/loopback.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios';
2-
import {host, restApiRoot, port} from '~/server/config.json';
2+
import {restApiHost, restApiRoot, port} from '~/server/config.json';
33
import {DateString} from 'loopback';
44

55
DateString.parse = function(dateString) {
@@ -35,7 +35,7 @@ function addTokenFromLocalStorage(http) {
3535
}
3636

3737
const http = axios.create({
38-
baseURL: `http://${host}:${port}${restApiRoot}`,
38+
baseURL: `http://${restApiHost}:${port}${restApiRoot}`,
3939
});
4040

4141
// Current setLoading function

template/gulp-tasks/config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,3 @@ dirs.testServer = path.resolve(dirs.test, 'server');
1919
dirs.srcClient = path.resolve(dirs.root, 'client');
2020
dirs.srcCommon = path.resolve(dirs.root, 'common');
2121
dirs.srcServer = path.resolve(dirs.root, 'server');
22-
23-
// Set here production build settings
24-
export const prod = {
25-
host: '0.0.0.0',
26-
port: 80,
27-
};

template/gulp-tasks/copy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import gulp from 'gulp';
33
import path from 'path';
44
import fs from 'fs';
55
import {argv} from 'yargs';
6-
import {dirs, prod} from './config';
6+
import {dirs} from './config';
7+
import production from '../server/config.production.json';
78

89
gulp.task('copy:client:fa', () => {
910
return gulp
@@ -41,7 +42,7 @@ gulp.task('copy:config:server', ['copy:server'], (done) => {
4142
path.resolve(dirs.buildServer, 'config.json'),
4243
JSON.stringify({
4344
...JSON.parse(data),
44-
...prod,
45+
...production,
4546
}),
4647
done
4748
);

template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build": "gulp build --production && npm run afterbuild",
1212
"afterbuild": "cd build && npm install --production",
1313
"test": "npx jest",
14-
"start": "node ./index.js"
14+
"start": "NODE_ENV=production node ."
1515
},
1616
"dependencies": {
1717
"compression": "^1.0.3",

template/server/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"restApiRoot": "/api",
3+
"restApiHost": "localhost",
34
"host": "0.0.0.0",
45
"port": 8000,
56
"remoting": {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"restApiHost": "123.123.123.123",
3+
"port": 80
4+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"db": {
3+
"name": "db",
4+
"host": "localhost",
5+
"port": 27017,
6+
"url": "",
7+
"database": "databaseName",
8+
"password": "",
9+
"user": "",
10+
"connector": "mongodb"
11+
}
12+
}

0 commit comments

Comments
 (0)