diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-01-17 08:37:24 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-01-17 08:37:24 +0900 |
| commit | 9abb108b5e6632302aa6844cb8d28c4a090ab1cc (patch) | |
| tree | 7e685abc1637595779fd8c80cf82b4b2bd22cc55 | |
| parent | [WIP] test (diff) | |
| download | sharkey-9abb108b5e6632302aa6844cb8d28c4a090ab1cc.tar.gz sharkey-9abb108b5e6632302aa6844cb8d28c4a090ab1cc.tar.bz2 sharkey-9abb108b5e6632302aa6844cb8d28c4a090ab1cc.zip | |
[BREAKING CHANGE] テスト時の設定ファイルを分けるように
See CHANGELOG for more details
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | gulpfile.ts | 4 | ||||
| -rw-r--r-- | src/config.ts | 14 | ||||
| -rw-r--r-- | tools/init.js | 2 |
4 files changed, 19 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b97f12f2ad..6cc1c58ab3 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 f3645bd9bf..09cbd98814 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 342e2db78b..d26ce5656d 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 1c012ea0d9..d981b87d3b 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 = [ { |