From 6a4e92a999e6798764d275e8776378c0b45c5271 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 15 Jul 2018 01:56:31 +0900 Subject: [PATCH] #1903 --- cli/init.js | 168 ----------------------------------------------- docs/setup.en.md | 3 +- docs/setup.ja.md | 2 +- package.json | 3 - 4 files changed, 3 insertions(+), 173 deletions(-) delete mode 100644 cli/init.js diff --git a/cli/init.js b/cli/init.js deleted file mode 100644 index 5a3650957..000000000 --- a/cli/init.js +++ /dev/null @@ -1,168 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const yaml = require('js-yaml'); -const inquirer = require('inquirer'); -const chalk = require('chalk'); - -const configDirPath = `${__dirname}/../.config`; -const configPath = `${configDirPath}/default.yml`; - -const form = [{ - type: 'input', - name: 'maintainerName', - message: 'Your name:' -}, { - type: 'input', - name: 'maintainerUrl', - message: 'Your home page URL or your mailto URL:' -}, { - type: 'input', - name: 'url', - message: 'URL you want to run Misskey:', - validate: function(wannabeurl) { - return wannabeurl.match('^http\(s?\)://') ? true : - 'URL needs to start with http:// or https://'; - } -}, { - type: 'input', - name: 'port', - message: 'Listen port (e.g. 443):' -}, { - type: 'confirm', - name: 'https', - message: 'Use TLS?', - default: false -}, { - type: 'input', - name: 'https_key', - message: 'Path of tls key:', - when: ctx => ctx.https -}, { - type: 'input', - name: 'https_cert', - message: 'Path of tls cert:', - when: ctx => ctx.https -}, { - type: 'input', - name: 'https_ca', - message: 'Path of tls ca:', - when: ctx => ctx.https -}, { - type: 'input', - name: 'mongo_host', - message: 'MongoDB\'s host:', - default: 'localhost' -}, { - type: 'input', - name: 'mongo_port', - message: 'MongoDB\'s port:', - default: '27017' -}, { - type: 'input', - name: 'mongo_db', - message: 'MongoDB\'s db:', - default: 'misskey' -}, { - type: 'input', - name: 'mongo_user', - message: 'MongoDB\'s user:' -}, { - type: 'password', - name: 'mongo_pass', - message: 'MongoDB\'s password:' -}, { - type: 'input', - name: 'redis_host', - message: 'Redis\'s host:', - default: 'localhost' -}, { - type: 'input', - name: 'redis_port', - message: 'Redis\'s port:', - default: '6379' -}, { - type: 'password', - name: 'redis_pass', - message: 'Redis\'s password:' -}, { - type: 'confirm', - name: 'elasticsearch', - message: 'Use Elasticsearch?', - default: false -}, { - type: 'input', - name: 'es_host', - message: 'Elasticsearch\'s host:', - default: 'localhost', - when: ctx => ctx.elasticsearch -}, { - type: 'input', - name: 'es_port', - message: 'Elasticsearch\'s port:', - default: '9200', - when: ctx => ctx.elasticsearch -}, { - type: 'password', - name: 'es_pass', - message: 'Elasticsearch\'s password:', - when: ctx => ctx.elasticsearch -}, { - type: 'input', - name: 'recaptcha_site', - message: 'reCAPTCHA\'s site key:' -}, { - type: 'input', - name: 'recaptcha_secret', - message: 'reCAPTCHA\'s secret key:' -}]; - -inquirer.prompt(form).then(as => { - // Mapping answers - const conf = { - maintainer: { - name: as['maintainerName'], - url: as['maintainerUrl'] - }, - url: as['url'], - port: parseInt(as['port'], 10), - mongodb: { - host: as['mongo_host'], - port: parseInt(as['mongo_port'], 10), - db: as['mongo_db'], - user: as['mongo_user'], - pass: as['mongo_pass'] - }, - redis: { - host: as['redis_host'], - port: parseInt(as['redis_port'], 10), - pass: as['redis_pass'] - }, - elasticsearch: { - enable: as['elasticsearch'], - host: as['es_host'] || null, - port: parseInt(as['es_port'], 10) || null, - pass: as['es_pass'] || null - }, - recaptcha: { - site_key: as['recaptcha_site'], - secret_key: as['recaptcha_secret'] - } - }; - - if (as['https']) { - conf.https = { - key: as['https_key'] || null, - cert: as['https_cert'] || null, - ca: as['https_ca'] || null - }; - } - - console.log(`Thanks. Writing the configuration to ${chalk.bold(path.resolve(configPath))}`); - - try { - fs.writeFileSync(configPath, yaml.dump(conf)); - console.log(chalk.green('Well done.')); - } catch (e) { - console.error(e); - } -}); diff --git a/docs/setup.en.md b/docs/setup.en.md index 5b1b5496e..b5bafcf80 100644 --- a/docs/setup.en.md +++ b/docs/setup.en.md @@ -43,7 +43,8 @@ Please install and setup these softwares: *4.* Make configuration file ---------------------------------------------------------------- -You need to generate config file via `npm run config` command. +1. Copy the `.config/example.yml` and rename it to `default.yml`. +2. Edit it *5.* Build Misskey ---------------------------------------------------------------- diff --git a/docs/setup.ja.md b/docs/setup.ja.md index b879af8d4..33929b751 100644 --- a/docs/setup.ja.md +++ b/docs/setup.ja.md @@ -43,7 +43,7 @@ web-push generate-vapid-keys *4.* 設定ファイルを作成する ---------------------------------------------------------------- -`npm run config`コマンドを利用して、ガイドに従って情報を入力してください。 +`.config/example.yml`をコピーしたのち`default.yml`にリネームして編集してください。 *5.* Misskeyのビルド ---------------------------------------------------------------- diff --git a/package.json b/package.json index 7669c5570..d240635de 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "main": "./built/index.js", "private": true, "scripts": { - "config": "node ./cli/init.js", "start": "node ./built", "debug": "DEBUG=misskey:* node ./built", "swagger": "node ./swagger.js", @@ -44,7 +43,6 @@ "@types/gulp-replace": "0.0.31", "@types/gulp-uglify": "3.0.5", "@types/gulp-util": "3.0.34", - "@types/inquirer": "0.0.42", "@types/is-root": "1.0.0", "@types/is-url": "1.2.28", "@types/js-yaml": "3.11.2", @@ -129,7 +127,6 @@ "highlight.js": "9.12.0", "html-minifier": "3.5.19", "http-signature": "1.2.0", - "inquirer": "6.0.0", "is-root": "2.0.0", "is-url": "1.2.4", "js-yaml": "3.12.0",