From 5834120107e0ab00e6a6163242d676946367a41a Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 17 Jan 2017 08:37:24 +0900 Subject: [PATCH] =?UTF-8?q?[BREAKING=20CHANGE]=20=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E6=99=82=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=82=92=E5=88=86=E3=81=91=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See CHANGELOG for more details --- CHANGELOG.md | 3 +++ gulpfile.ts | 4 ++-- src/config.ts | 14 +++++++++++++- tools/init.js | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b97f12f2a..6cc1c58ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Server +## 2 +configのファイル名: config.yml --> default.yml + ## 1 First version diff --git a/gulpfile.ts b/gulpfile.ts index f3645bd9b..09cbd9881 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -31,12 +31,12 @@ const env = process.env.NODE_ENV; const isProduction = env === 'production'; const isDebug = !isProduction; -if (!fs.existsSync('./.config/config.yml')) { +if (!fs.existsSync('./.config/default.yml')) { console.log('npm run configを実行して設定ファイルを作成してください'); process.exit(); } -(global as any).MISSKEY_CONFIG_PATH = '.config/config.yml'; +(global as any).MISSKEY_CONFIG_PATH = '.config/default.yml'; import { IConfig } from './src/config'; const config = eval(require('typescript').transpile(require('fs').readFileSync('./src/config.ts').toString()))() as IConfig; diff --git a/src/config.ts b/src/config.ts index 342e2db78..d26ce5656 100644 --- a/src/config.ts +++ b/src/config.ts @@ -6,7 +6,19 @@ import * as fs from 'fs'; import * as yaml from 'js-yaml'; import * as isUrl from 'is-url'; -export const path = (global as any).MISSKEY_CONFIG_PATH ? (global as any).MISSKEY_CONFIG_PATH : `${__dirname}/../.config/config.yml`; +/** + * Path of configuration directory + */ +const dir = `${__dirname}/../.config`; + +/** + * Path of configuration file + */ +export const path = (global as any).MISSKEY_CONFIG_PATH + ? (global as any).MISSKEY_CONFIG_PATH + : process.env.NODE_ENV == 'test' + ? `${dir}/test.yml` + : `${dir}/default.yml`; /** * ユーザーが設定する必要のある情報 diff --git a/tools/init.js b/tools/init.js index 1c012ea0d..d981b87d3 100644 --- a/tools/init.js +++ b/tools/init.js @@ -3,7 +3,7 @@ const yaml = require('js-yaml'); const inquirer = require('inquirer'); const configDirPath = `${__dirname}/../.config`; -const configPath = `${configDirPath}/config.yml`; +const configPath = `${configDirPath}/default.yml`; const form = [ {