mirror of
https://github.com/wassname/talk.git
synced 2026-07-16 11:22:16 +08:00
documented more env vars
This commit is contained in:
@@ -102,7 +102,10 @@ const CONFIG = {
|
||||
|
||||
// DISABLE_AUTOFLAG_SUSPECT_WORDS is true when the suspect words that are
|
||||
// matched should not be flagged.
|
||||
DISABLE_AUTOFLAG_SUSPECT_WORDS: process.env.TALK_DISABLE_AUTOFLAG_SUSPECT_WORDS === 'TRUE'
|
||||
DISABLE_AUTOFLAG_SUSPECT_WORDS: process.env.TALK_DISABLE_AUTOFLAG_SUSPECT_WORDS === 'TRUE',
|
||||
|
||||
// TRUST_THRESHOLDS defines the thresholds used for automoderation.
|
||||
TRUST_THRESHOLDS: process.env.TRUST_THRESHOLDS || 'comment:-1,-1;flag:-1,-1'
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -37,6 +37,15 @@ environment variables. Refer to the
|
||||
[config.js](https://github.com/coralproject/talk/blob/master/config.js) file to
|
||||
see how the configuration is parsed.
|
||||
|
||||
### Webpack
|
||||
|
||||
These are only used during the webpack build.
|
||||
|
||||
- `TALK_THREADING_LEVEL` (_optional_) - specify the maximum depth of the comment
|
||||
thread. (Default `3`)
|
||||
- `TALK_DEFAULT_STREAM_TAB` (_optional_) - specify the default stream tab in the
|
||||
admin. (Default `all`)
|
||||
|
||||
### Database
|
||||
|
||||
- `TALK_MONGO_URL` (*required*) - the database connection string for the MongoDB database.
|
||||
@@ -91,6 +100,29 @@ on the contents of those variables.**
|
||||
- `TALK_RECAPTCHA_SECRET` (*required for reCAPTCHA support*) - server secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout.
|
||||
- `TALK_RECAPTCHA_PUBLIC` (*required for reCAPTCHA support*) - client secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout.
|
||||
|
||||
### Trust
|
||||
|
||||
Trust can automoderate comments based on user history. By specifying this
|
||||
option, the beheviour can be changed to offer different results.
|
||||
|
||||
- `TRUST_THRESHOLDS` (_optional_) - configure the reliability thresholds for
|
||||
flagging and commenting. (Default `comment:-1,-1;flag:-1,-1`)
|
||||
|
||||
The form of the environment variable:
|
||||
|
||||
```
|
||||
<name>:<RELIABLE>,<UNRELIABLE>;<name>:<RELIABLE>,<UNRELIABLE>;...
|
||||
```
|
||||
|
||||
The default could be read as:
|
||||
|
||||
- When a commenter has one comment rejected, their next comment must be
|
||||
premoderated once in order to post freely again. If they instead get rejected
|
||||
again, then they must have two of their comments approved in order to get
|
||||
added back to the queue.
|
||||
- At the moment of writing, beheviour is not attached to the flagging
|
||||
reliability, but it is recorded.
|
||||
|
||||
### Plugins
|
||||
|
||||
- `TALK_PLUGINS_JSON` (_optional_) - used to specify the plugin config via the
|
||||
|
||||
+14
-11
@@ -1,22 +1,25 @@
|
||||
const debug = require('debug')('talk:services:karma');
|
||||
const UserModel = require('../models/user');
|
||||
const {
|
||||
TRUST_THRESHOLDS
|
||||
} = require('../config');
|
||||
|
||||
/**
|
||||
* This will create an object with the property name of the action type as the
|
||||
* key and an object as it's value. This will contain a RELIABLE, and UNRELIABLE
|
||||
* property with the number of karma points associated with their particular
|
||||
* state.
|
||||
*
|
||||
*
|
||||
* If only the RELIABLE variable is provided, then it will also be used as the
|
||||
* UNRELIABLE variable.
|
||||
*
|
||||
*
|
||||
* The form of the environment variable is:
|
||||
*
|
||||
*
|
||||
* <name>:<RELIABLE>,<UNRELIABLE>;<name>:<RELIABLE>,<UNRELIABLE>;...
|
||||
*
|
||||
*
|
||||
* The default used is:
|
||||
*
|
||||
* comment:1,1;flag:-1,-1
|
||||
*
|
||||
* comment:-1,-1;flag:-1,-1
|
||||
*/
|
||||
const parseThresholds = (thresholds) => thresholds
|
||||
.split(';')
|
||||
@@ -50,16 +53,16 @@ const parseThresholds = (thresholds) => thresholds
|
||||
return acc;
|
||||
}, {
|
||||
comment: {
|
||||
RELIABLE: -1,
|
||||
UNRELIABLE: -1
|
||||
RELIABLE: 0,
|
||||
UNRELIABLE: 0
|
||||
},
|
||||
flag: {
|
||||
RELIABLE: -1,
|
||||
UNRELIABLE: -1
|
||||
RELIABLE: 0,
|
||||
UNRELIABLE: 0
|
||||
}
|
||||
});
|
||||
|
||||
const THRESHOLDS = parseThresholds(process.env.TRUST_THRESHOLDS || '');
|
||||
const THRESHOLDS = parseThresholds(TRUST_THRESHOLDS);
|
||||
|
||||
debug('using thresholds: ', THRESHOLDS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user