-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-config
executable file
·86 lines (78 loc) · 2.02 KB
/
create-config
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env node
/*
This file creates and writes our production config after the build has been completed.
Make changes here if you want to use a different image storage service or email provider.
*/
var fs = require("fs");
var path = require("path");
var appRoot = path.join(__dirname, "..");
function createConfig() {
var fileStorage, storage;
if (process.env.CLOUDINARY_URL) {
console.log("CLOUDINARY_URL found, setting storage to cloudinary");
fileStorage = true;
storage = {
active: "cloudinary",
cloudinary: {
useDatedFolder: false,
upload: {
use_filename: true,
unique_filename: false,
overwrite: false,
folder: "ghost-blog-images",
tags: ["blog"],
},
fetch: {
quality: "auto",
secure: true,
cdn_subdomain: true,
},
},
};
} else {
console.log("CLOUDINARY_URL not found, setting storage to false");
fileStorage = false;
storage = {};
}
config = {
url: process.env.BLOG_URL,
logging: {
level: "info",
transports: ["stdout"],
},
mail: {
transport: "SMTP",
options: {
service: "Mailgun",
auth: {
user: process.env.MAILGUN_SMTP_LOGIN,
pass: process.env.MAILGUN_SMTP_PASSWORD,
},
},
},
fileStorage: fileStorage,
storage: storage,
database: {
client: "mysql",
connection: {
host: process.env.MYSQLHOST,
port: process.env.MYSQLPORT,
user: process.env.MYSQLUSER,
password: process.env.MYSQLPASSWORD,
database: process.env.MYSQLDATABASE,
},
pool: { min: 0, max: 5 },
debug: false,
},
server: {
host: "0.0.0.0",
port: process.env.PORT,
},
paths: {
contentPath: path.join(appRoot, "/content/"),
},
};
return config;
}
var configContents = JSON.stringify(createConfig(), null, 2);
fs.writeFileSync(path.join(appRoot, "config.production.json"), configContents);