-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.js
53 lines (47 loc) · 1.43 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// # Ghost Configuration
// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments).
// Full documentation can be found at http://support.ghost.org/config/
var devModeUrl = `http://${myIpAddress()}:2368`;
module.exports = {
// production: Default when started via docker-compose
production: buildConfig('https://' + process.env.BLOG_DOMAIN),
// development: URL is one of the network interfaces ip-adress
development: buildConfig(devModeUrl)
};
if (process.env.NODE_ENV==='development') {
console.log(`Configuring development url for Ghost as: ${devModeUrl}`)
}
function buildConfig(url) {
return {
url: url,
database: {
client: 'mysql',
connection: {
host: 'mysql',
user: 'ghost',
password: process.env.MYSQL_PASSWORD,
database: 'ghost_db',
charset: 'utf8'
}
},
server: {
host: '0.0.0.0',
port: '2368'
},
paths: {
contentPath: process.env.GHOST_CONTENT
}
}
}
/**
* Get the ipv4-address of the `eth0` device (which should
* exist in the current docker-setup.
* @returns {string} the ip-address
*/
function myIpAddress() {
return require('os')
.networkInterfaces()
.eth0
.filter((iface) => iface.family === 'IPv4')[0]
.address;
}