Skip to content

Configuration

Michael Spalti edited this page Feb 8, 2017 · 7 revisions

Environment

The /server/config/environment.js file defines the configuration for the current NODE run-time environment (development, production or test). Many of the values are defined in a credentials file. Values defined directly inside enviroment.js are:

  • The server port.
  • The mysql host and port.
  • The server dialect (mysql or mariadb)
  • Paths to executables (e.g. convert and identify) and working directories (e.g. the image directory)
  • Whether to require OAUTH2 authentication
  • Whether to force sync the database on startup (this will true for testing only!)

Here's an example configuration for the production run time:

  production: {
    app: {
      name: 'tagger'
    },
    credentialsPath: '',
    logLevel: 'info',
    dbLog: false,
    sync: {force: false},
    useAuth: true,
    uid: credentials.uid,
    gid: credentials.gid,
    port: 3000,
    redisPort: credentials.redisPort,
    mysql: {
      db: 'acomtags',
      user: credentials.user,
      password: credentials.password,
      host: credentials.productiondbhost,
      port: 3306,
      dialect: 'mariadb'
    },
    convert: '/usr/bin/convert',
    identify: '/usr/bin/identify',
    taggerImageDir: '/var/taggerImages',
    adminPath: '/views',
    domain: credentials.domain,
    googleClientId: credentials.googleClientId,
    googleClientSecret: credentials.googleClientSecret,
    googleCallback: credentials.googleCallback,
    externalHostA: credentials.externalHostA,
    externalHostB: '', // not in use
    nodeEnv: env
  }

Credentials

You will need to provide a credentials.js file. For development, the place this file in your home directory in the following subdirectory etc/tagger. In production, place the file in the root /etc directory, inside a tagger subdirectory, e.g. /etc/tagger/credentials.js. If you need to modify the file location, see see config/require-paths.js.

Here's a sample config file. Also see the sample configuration file in the project at server/credentials/credentials.sample.js.

 'use strict';

var credentials = {

  develuid: '<your local system uid>',
  develgid: '<your local system gid>',
  develdbuser: '<development database user name>',
  develdbpassword: '<development database password>',
  googleClientId: '<google oauth client id>',
  googleClientSecret: '<google oauth client secret>',
  googleCallback: '<google oauth callback>',
  uid: '<node uid on production system>',
  gid: '<node gid on production system>',
  user: '<production database user>',
  password: '<production database password>',
  productiondbhost: '<production database host>',
  domain: '<email domain used for authentication>',
  redisPort: '<the redis port number>',
  externalHostA: {  // This is the browse-by-year API for exist collections. Disappearing soon.
    host: '<external host name>',
    port: '<external host port>',
    path: '<external host api query path>'
  }

};

module.exports = credentials;
Clone this wiki locally