BVB Source Codes

mongo-express Show config.default.js Source code

Return Download mongo-express: download config.default.js Source code - Download mongo-express Source code - Type:.js
  1. 'use strict';
  2.  
  3. var mongo;
  4. var url = require('url');
  5.  
  6. if (typeof process.env.MONGODB_PORT === 'string') {
  7.   var mongoConnection = url.parse(process.env.MONGODB_PORT);
  8.   process.env.ME_CONFIG_MONGODB_SERVER  = mongoConnection.hostname;
  9.   process.env.ME_CONFIG_MONGODB_PORT    = mongoConnection.port;
  10. }
  11.  
  12. // Accesing Bluemix variable to get MongoDB info
  13. if (process.env.VCAP_SERVICES) {
  14.   var dbLabel = 'mongodb-2.4';
  15.   var env = JSON.parse(process.env.VCAP_SERVICES);
  16.   if (env[dbLabel]) {
  17.     mongo = env[dbLabel][0].credentials;
  18.   }
  19. } else {
  20.   mongo = {
  21.     db:       'db',
  22.     host:     'localhost',
  23.     password: 'pass',
  24.     port:     27017,
  25.     ssl:      false,
  26.     url:      'mongodb://localhost:27017/db',
  27.     username: 'admin',
  28.   };
  29. }
  30.  
  31. var meConfigMongodbServer = process.env.ME_CONFIG_MONGODB_SERVER ? process.env.ME_CONFIG_MONGODB_SERVER.split(',') : false;
  32.  
  33. module.exports = {
  34.   mongodb: {
  35.     //server: mongodb hostname or IP address
  36.     //for replica set, use array of string instead
  37.     server: (meConfigMongodbServer.length > 1 ? meConfigMongodbServer : meConfigMongodbServer[0]) || mongo.host,
  38.     port:   process.env.ME_CONFIG_MONGODB_PORT    || mongo.port,
  39.  
  40.     //ssl: connect to the server using secure SSL
  41.     ssl: process.env.ME_CONFIG_MONGODB_SSL || mongo.ssl,
  42.  
  43.     //sslValidate: validate mongod server certificate against CA
  44.     sslValidate: process.env.ME_CONFIG_MONGODB_SSLVALIDATE || true,
  45.  
  46.     //sslCA: array of valid CA certificates
  47.     sslCA:  [],
  48.  
  49.     //autoReconnect: automatically reconnect if connection is lost
  50.     autoReconnect: true,
  51.  
  52.     //poolSize: size of connection pool (number of connections to use)
  53.     poolSize: 4,
  54.  
  55.     //set admin to true if you want to turn on admin features
  56.     //if admin is true, the auth list below will be ignored
  57.     //if admin is true, you will need to enter an admin username/password below (if it is needed)
  58.     admin: process.env.ME_CONFIG_MONGODB_ENABLE_ADMIN ? process.env.ME_CONFIG_MONGODB_ENABLE_ADMIN.toLowerCase() === 'true' : false,
  59.  
  60.     // >>>>  If you are using regular accounts, fill out auth details in the section below
  61.     // >>>>  If you have admin auth, leave this section empty and skip to the next section
  62.     auth: [
  63.       /*
  64.        * Add the name, username, and password of the databases you want to connect to
  65.        * Add as many databases as you want!
  66.        */
  67.       {
  68.         database: process.env.ME_CONFIG_MONGODB_AUTH_DATABASE || mongo.db,
  69.         username: process.env.ME_CONFIG_MONGODB_AUTH_USERNAME || mongo.username,
  70.         password: process.env.ME_CONFIG_MONGODB_AUTH_PASSWORD || mongo.password,
  71.       },
  72.     ],
  73.  
  74.     //  >>>>  If you are using an admin mongodb account, or no admin account exists, fill out section below
  75.     //  >>>>  Using an admin account allows you to view and edit all databases, and view stats
  76.  
  77.     //leave username and password empty if no admin account exists
  78.     adminUsername: process.env.ME_CONFIG_MONGODB_ADMINUSERNAME || '',
  79.     adminPassword: process.env.ME_CONFIG_MONGODB_ADMINPASSWORD || '',
  80.  
  81.     //whitelist: hide all databases except the ones in this list  (empty list for no whitelist)
  82.     whitelist: [],
  83.  
  84.     //blacklist: hide databases listed in the blacklist (empty list for no blacklist)
  85.     blacklist: [],
  86.   },
  87.  
  88.   site: {
  89.     // baseUrl: the URL that mongo express will be located at - Remember to add the forward slash at the start and end!
  90.     baseUrl: process.env.ME_CONFIG_SITE_BASEURL || '/',
  91.     cookieKeyName: 'mongo-express',
  92.     cookieSecret:     process.env.ME_CONFIG_SITE_COOKIESECRET   || 'cookiesecret',
  93.     host:             process.env.VCAP_APP_HOST                 || 'localhost',
  94.     port:             process.env.VCAP_APP_PORT                 || 8081,
  95.     requestSizeLimit: process.env.ME_CONFIG_REQUEST_SIZE        || '50mb',
  96.     sessionSecret:    process.env.ME_CONFIG_SITE_SESSIONSECRET  || 'sessionsecret',
  97.     sslCert:          process.env.ME_CONFIG_SITE_SSL_CRT_PATH   || '',
  98.     sslEnabled:       process.env.ME_CONFIG_SITE_SSL_ENABLED    || false,
  99.     sslKey:           process.env.ME_CONFIG_SITE_SSL_KEY_PATH   || '',
  100.   },
  101.  
  102.   //set useBasicAuth to true if you want to authenticate mongo-express loggins
  103.   //if admin is false, the basicAuthInfo list below will be ignored
  104.   //this will be true unless ME_CONFIG_BASICAUTH_USERNAME is set and is the empty string
  105.   useBasicAuth: process.env.ME_CONFIG_BASICAUTH_USERNAME !== '',
  106.  
  107.   basicAuth: {
  108.     username: process.env.ME_CONFIG_BASICAUTH_USERNAME || 'admin',
  109.     password: process.env.ME_CONFIG_BASICAUTH_PASSWORD || 'pass',
  110.   },
  111.  
  112.   options: {
  113.     // Display startup text on console
  114.     console: true,
  115.  
  116.     //documentsPerPage: how many documents you want to see at once in collection view
  117.     documentsPerPage: 10,
  118.  
  119.     //editorTheme: Name of the theme you want to use for displaying documents
  120.     //See http://codemirror.net/demo/theme.html for all examples
  121.     editorTheme: process.env.ME_CONFIG_OPTIONS_EDITORTHEME || 'rubyblue',
  122.  
  123.     // Maximum size of a single property & single row
  124.     // Reduces the risk of sending a huge amount of data when viewing collections
  125.     maxPropSize: (100 * 1000),  // default 100KB
  126.     maxRowSize: (1000 * 1000),  // default 1MB
  127.  
  128.     //The options below aren't being used yet
  129.  
  130.     //cmdType: the type of command line you want mongo express to run
  131.     //values: eval, subprocess
  132.     //  eval - uses db.eval. commands block, so only use this if you have to
  133.     //  subprocess - spawns a mongo command line as a subprocess and pipes output to mongo express
  134.     cmdType: 'eval',
  135.  
  136.     //subprocessTimeout: number of seconds of non-interaction before a subprocess is shut down
  137.     subprocessTimeout: 300,
  138.  
  139.     //readOnly: if readOnly is true, components of writing are not visible.
  140.     readOnly: false,
  141.  
  142.     //collapsibleJSON: if set to true, jsons will be displayed collapsible
  143.     collapsibleJSON: true,
  144.  
  145.     //collapsibleJSONDefaultUnfold: if collapsibleJSON is set to `true`, this defines default level
  146.     //  to which JSONs are displayed unfolded; use number or "all" to unfold all levels
  147.     collapsibleJSONDefaultUnfold: 1,
  148.  
  149.     //gridFSEnabled: if gridFSEnabled is set to 'true', you will be able to manage uploaded files ( ak. grids, gridFS )
  150.     gridFSEnabled: process.env.ME_CONFIG_SITE_GRIDFS_ENABLED || false,
  151.  
  152.     // logger: this object will be used to initialize router logger (morgan)
  153.     logger: {},
  154.   },
  155.  
  156.   // Specify the default keyname that should be picked from a document to display in collections list.
  157.   // Keynames can be specified for every database and collection.
  158.   // If no keyname is specified, it defaults to '_id', which is a mandatory field.
  159.   // For Example :
  160.   // defaultKeyNames{
  161.   //   "world_db":{  //Database Name
  162.   //     "continent":"cont_name", // collection:field
  163.   //     "country":"country_name",
  164.   //     "city":"name"
  165.   //   }
  166.   // }
  167.   defaultKeyNames: {
  168.  
  169.   },
  170. };
  171.  
downloadconfig.default.js Source code - Download mongo-express Source code
Related Source Codes/Software:
XCL-Charts - Android charting libraries (XCL-Charts is a free c... 2017-05-17
scrollMonitor - A simple and fast API to monitor elements as you s... 2017-05-16
XCDYouTubeKit - YouTube video player for iOS, tvOS and macOS 2017-05-16
rails-erd - Generate Entity-Relationship Diagrams for Rails ap... 2017-05-16
np - A better `npm publish` 2017-05-16
kaminari - A Scope & Engine based, clean, powerful, custo... 2017-06-04
python-fire - Python Fire is a library for automatically generat... 2017-06-04
Dapper - Dapper - a simple object mapper for .Net 2017-06-05
pkg - Package your Node.js project into an executable ... 2017-06-05
packer - Packer is a tool for creating identical machine im... 2017-06-05
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top