Skip to content

Commit

Permalink
Merge pull request #64 from Notastica/better-docs
Browse files Browse the repository at this point in the history
Better docs
  • Loading branch information
Panthro committed Nov 9, 2016
2 parents 51c95d8 + d08055a commit 6106340
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ docker run --name orc -v /data --link=mq --link=es -e ENABLE_ELASTICSEARCH=true

```

__NOTE:__ There are several environment variables that can be set when launching the orchestrator, see them all in [app.js](./src/app.js)
__NOTE:__ There are several environment variables that can be set when launching the orchestrator, see them all in [options.js](./src/options.js)

- Create your module

Expand Down
4 changes: 3 additions & 1 deletion src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class Module extends EventEmitter {
}

options = _.defaults(options, defaults);
logger.debug('Initializing module with options:', options);
if (!options instanceof Module) {
logger.debug('Initializing module with options:', options);
}

// Simple properties that should be added to JSON
// ---------------------------------------------
Expand Down
85 changes: 84 additions & 1 deletion src/options.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,109 @@
/**
* default options from env variables
*/
// TODO document all them here
export default {

/**
* the path where the orchestrator database will be stored, it's a .json file
*/

dbPath: process.env.DB_PATH,

/**
* the name of the Orchestrator
*/

name: process.env.NAME,

/**
*the name of the modules collections in the orchestrator's database
*/

modulesCollectionName: process.env.MODULES_COLLECTION_NAME || 'modules',

/**
* the name of the registration queue where the orchestrator will be listening and new modules should register themselves
*/

registerQueue: process.env.REQISTER_QUEUE || 'o_register',

/**
* The name of the messages queue where the Orchestrator will be listening for new messages
*/
messagesQueue: process.env.MESSAGES_QUEUE || 'o_messages',

/**
* The AMQP url, can be any valid amqp uri: https://www.rabbitmq.com/uri-spec.html
*/
amqpURL: process.env.AMQP_URL || 'amqp://localhost:5672',

/**
* The index where elasticsearch should store messages, if enabled.
*/
messagesIndex: process.env.MESSAGES_INDEX || 'messages',

/**
* The type under elasticsearch should store messages, if enabled
*/
messagesType: process.env.MESSAGES_TYPE || 'mType',

/**
* The elasticsearch host, if enabled.
*/
esHost: process.env.ES_HOST || 'localhost:9200',

/**
* Whether to enable or not elasticsearch
*/
ENABLE_ELASTICSEARCH: process.env.ENABLE_ELASTICSEARCH,

/**
* Google api key for the Gomodule
*/
googleApiKey: process.env.GEO_GAPI_KEY,

/**
* Whether the geoModule should query elasticsearch for the same venues before asking Google Maps
*/
geoQueryEs: process.env.GEO_QUERY_ES || false,

/**
* What is the venue field that should be used to query ES when looking for matching venues
*/
geoSameVenueField: process.env.GEO_SAME_VENUE_FIELD,

/**
* Which field to sort when querying elasticsearch for matching venues
*/
geoSortEsQueryField: process.env.GEO_SORT_FIELD,

/**
* Sort order when querying elasticsearch
*/
geoSortQueryOrder: process.env.GEO_SORT_ORDER || 'desc',

/**
* Geo module negative JSON path
*/
geoNegativePath: process.env.GEO_NEGATIVE_PATH,

/**
* Geo module positive JSON path
*/
geoPositivePath: process.env.GEO_POSITIVE_PATH,

/**
* A comma separated list of fields (jsonpath) that should be used to create the full address
*/
geoSourceFields: process.env.GEO_SOURCE_FIELDS,

/**
* The destination field where the geocoded address should be stored
*/
geoDestinationField: process.env.GEO_DESTINATION_FIELD,

/**
* How many messages should the geocoding module prefetch
*/
geoPrefetch: process.env.GEO_PREFETCH ? parseInt(process.env.GEO_PREFETCH, 10) : process.env.GEO_PREFETCH
};

0 comments on commit 6106340

Please sign in to comment.