aboutsummaryrefslogtreecommitdiff
path: root/src/wizard.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2019-02-21 23:49:29 +0900
committerPitu <[email protected]>2019-02-21 23:49:29 +0900
commit44e6fd31d2fa7761c90ff1d6932cf69d163b22e8 (patch)
treecaa404d59b5817e5a302df55d66a740765fc24d2 /src/wizard.js
parentderp (diff)
downloadhost.fuwn.me-44e6fd31d2fa7761c90ff1d6932cf69d163b22e8.tar.xz
host.fuwn.me-44e6fd31d2fa7761c90ff1d6932cf69d163b22e8.zip
Database migration and seeding
Diffstat (limited to 'src/wizard.js')
-rw-r--r--src/wizard.js44
1 files changed, 37 insertions, 7 deletions
diff --git a/src/wizard.js b/src/wizard.js
index affa759..3094488 100644
--- a/src/wizard.js
+++ b/src/wizard.js
@@ -1,3 +1,4 @@
+const randomstring = require('randomstring');
const jetpack = require('fs-jetpack');
const qoa = require('qoa');
qoa.config({
@@ -15,6 +16,10 @@ async function start() {
});
if (!confirm.run) process.exit(0);
+ console.log();
+ console.log('You can manually edit .env file after the wizard to edit values');
+ console.log();
+
const wizard = [
{
type: 'input',
@@ -94,9 +99,34 @@ async function start() {
deny: 'n'
},
{
+ type: 'input',
+ query: 'Name of the admin account?',
+ handle: 'ADMIN_ACCOUNT'
+ },
+ {
type: 'secure',
query: 'Type a secure password for the root user:',
- handle: 'ROOT_PASSWORD'
+ handle: 'ADMIN_PASSWORD'
+ },
+ {
+ type: 'input',
+ query: 'Database host',
+ handle: 'DB_HOST'
+ },
+ {
+ type: 'input',
+ query: 'Database user',
+ handle: 'DB_USER'
+ },
+ {
+ type: 'input',
+ query: 'Database password',
+ handle: 'DB_PASSWORD'
+ },
+ {
+ type: 'input',
+ query: 'Database name',
+ handle: 'DB_DATABASE'
}
];
@@ -109,13 +139,9 @@ async function start() {
RATE_LIMIT_WINDOW: 2,
RATE_LIMIT_MAX: 5,
DB_CLIENT: 'pg',
- DB_HOST: 'localhost',
- DB_USER: '',
- DB_PASSWORD: '',
- DB_DATABASE: '',
BLOCKED_EXTENSIONS: ['.jar', '.exe', '.msi', '.com', '.bat', '.cmd', '.scr', '.ps1', '.sh'],
UPLOAD_FOLDER: 'uploads',
- SECRET: 'SuperSecretPassphraseHere',
+ SECRET: randomstring.generate(64),
MAX_LINKS_PER_ALBUM: 5
};
@@ -128,7 +154,11 @@ async function start() {
jetpack.write('.env', envfile);
console.log();
- console.log('== .env file generated successfully. You can now run lolisafe ==');
+ console.log('=============================================');
+ console.log('== .env file generated successfully. ==');
+ console.log('=============================================');
+ console.log('== Run `yarn migrate` and `yarn seed` next ==');
+ console.log('=============================================');
console.log();
}