mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-02 20:15:25 +02:00
Move testing to 3001 port (#8)
Create separate database for testing Add runtime configuration file support
This commit is contained in:
parent
073772c047
commit
452d0ae816
17 changed files with 547 additions and 36 deletions
4
config/development.json
Normal file
4
config/development.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"port": 3000,
|
||||
"database": ".db"
|
||||
}
|
22
config/index.js
Normal file
22
config/index.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* This module reads configuration file depending on NODE_ENV
|
||||
*
|
||||
* @type {module}
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
const configPath = `./${NODE_ENV}.json`;
|
||||
let config;
|
||||
|
||||
if (fs.existsSync(path.resolve(__dirname, configPath))) {
|
||||
config = require(configPath);
|
||||
} else {
|
||||
config = {
|
||||
database: '.db',
|
||||
port: 3000
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = config;
|
4
config/production.json
Normal file
4
config/production.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"port": 3000,
|
||||
"database": ".db"
|
||||
}
|
5
config/testing.json
Normal file
5
config/testing.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"port": 3001,
|
||||
"database": ".testdb",
|
||||
"rcFile": "./test/.codexdocsrc"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue