mirror of https://github.com/status-im/codimd.git
commit
8cf849e825
|
@ -120,6 +120,7 @@ Environment variables (will overwrite other server configs)
|
||||||
| HMD_USECDN | `true` or `false` | set to use CDN resources or not (default is `true`) |
|
| HMD_USECDN | `true` or `false` | set to use CDN resources or not (default is `true`) |
|
||||||
| HMD_ALLOW_ANONYMOUS | `true` or `false` | set to allow anonymous usage (default is `true`) |
|
| HMD_ALLOW_ANONYMOUS | `true` or `false` | set to allow anonymous usage (default is `true`) |
|
||||||
| HMD_ALLOW_FREEURL | `true` or `false` | set to allow new note by accessing not exist note url |
|
| HMD_ALLOW_FREEURL | `true` or `false` | set to allow new note by accessing not exist note url |
|
||||||
|
| HMD_DB_URL | `mysql://localhost:3306/database` | set the db url |
|
||||||
| HMD_FACEBOOK_CLIENTID | no example | Facebook API client id |
|
| HMD_FACEBOOK_CLIENTID | no example | Facebook API client id |
|
||||||
| HMD_FACEBOOK_CLIENTSECRET | no example | Facebook API client secret |
|
| HMD_FACEBOOK_CLIENTSECRET | no example | Facebook API client secret |
|
||||||
| HMD_TWITTER_CONSUMERKEY | no example | Twitter API consumer key |
|
| HMD_TWITTER_CONSUMERKEY | no example | Twitter API consumer key |
|
||||||
|
@ -157,6 +158,7 @@ Server settings `config.json`
|
||||||
| usecdn | `true` or `false` | set to use CDN resources or not (default is `true`) |
|
| usecdn | `true` or `false` | set to use CDN resources or not (default is `true`) |
|
||||||
| allowanonymous | `true` or `false` | set to allow anonymous usage (default is `true`) |
|
| allowanonymous | `true` or `false` | set to allow anonymous usage (default is `true`) |
|
||||||
| allowfreeurl | `true` or `false` | set to allow new note by accessing not exist note url |
|
| allowfreeurl | `true` or `false` | set to allow new note by accessing not exist note url |
|
||||||
|
| dburl | `mysql://localhost:3306/database` | set the db url, if set this variable then below db config won't be applied |
|
||||||
| db | `{ "dialect": "sqlite", "storage": "./db.hackmd.sqlite" }` | set the db configs, [see more here](http://sequelize.readthedocs.org/en/latest/api/sequelize/) |
|
| db | `{ "dialect": "sqlite", "storage": "./db.hackmd.sqlite" }` | set the db configs, [see more here](http://sequelize.readthedocs.org/en/latest/api/sequelize/) |
|
||||||
| sslkeypath | `./cert/client.key` | ssl key path (only need when you set usessl) |
|
| sslkeypath | `./cert/client.key` | ssl key path (only need when you set usessl) |
|
||||||
| sslcertpath | `./cert/hackmd_io.crt` | ssl cert path (only need when you set usessl) |
|
| sslcertpath | `./cert/hackmd_io.crt` | ssl cert path (only need when you set usessl) |
|
||||||
|
|
|
@ -23,12 +23,6 @@ EOF
|
||||||
|
|
||||||
{
|
{
|
||||||
"production": {
|
"production": {
|
||||||
"db": {
|
|
||||||
"database": "${DATABASE_URL}",
|
|
||||||
"dialectOptions": {
|
|
||||||
"ssl": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"test": {
|
||||||
|
"dialect": "sqlite",
|
||||||
|
"storage": "./db.hackmd.sqlite"
|
||||||
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"domain": "localhost",
|
"domain": "localhost",
|
||||||
"db": {
|
"db": {
|
||||||
|
|
|
@ -24,10 +24,8 @@ var allowanonymous = process.env.HMD_ALLOW_ANONYMOUS ? (process.env.HMD_ALLOW_AN
|
||||||
var allowfreeurl = process.env.HMD_ALLOW_FREEURL ? (process.env.HMD_ALLOW_FREEURL === 'true') : !!config.allowfreeurl;
|
var allowfreeurl = process.env.HMD_ALLOW_FREEURL ? (process.env.HMD_ALLOW_FREEURL === 'true') : !!config.allowfreeurl;
|
||||||
|
|
||||||
// db
|
// db
|
||||||
var db = config.db || {
|
var dburl = config.dburl || process.env.HMD_DB_URL || process.env.DATABASE_URL;
|
||||||
dialect: 'sqlite',
|
var db = config.db || {};
|
||||||
storage: './db.hackmd.sqlite'
|
|
||||||
};
|
|
||||||
|
|
||||||
// ssl path
|
// ssl path
|
||||||
var sslkeypath = config.sslkeypath || '';
|
var sslkeypath = config.sslkeypath || '';
|
||||||
|
@ -131,6 +129,7 @@ module.exports = {
|
||||||
usecdn: usecdn,
|
usecdn: usecdn,
|
||||||
allowanonymous: allowanonymous,
|
allowanonymous: allowanonymous,
|
||||||
allowfreeurl: allowfreeurl,
|
allowfreeurl: allowfreeurl,
|
||||||
|
dburl: dburl,
|
||||||
db: db,
|
db: db,
|
||||||
sslkeypath: path.join(cwd, sslkeypath),
|
sslkeypath: path.join(cwd, sslkeypath),
|
||||||
sslcertpath: path.join(cwd, sslcertpath),
|
sslcertpath: path.join(cwd, sslcertpath),
|
||||||
|
|
|
@ -13,10 +13,12 @@ var dbconfig = config.db;
|
||||||
dbconfig.logging = config.debug ? logger.info : false;
|
dbconfig.logging = config.debug ? logger.info : false;
|
||||||
|
|
||||||
var sequelize = null;
|
var sequelize = null;
|
||||||
if (dbconfig.hasOwnProperty('username') || dbconfig.hasOwnProperty('password'))
|
|
||||||
sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig);
|
// Heroku specific
|
||||||
|
if (config.dburl)
|
||||||
|
sequelize = new Sequelize(config.dburl, dbconfig);
|
||||||
else
|
else
|
||||||
sequelize = new Sequelize(dbconfig.database, dbconfig);
|
sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig);
|
||||||
|
|
||||||
var db = {};
|
var db = {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue