Configurations in Ocular live in ocular-config-local.js when running the application fully in Docker or ocular-config-dev.js when running Ocular in dev mode.

ocular-config-xxx.js export a configuration wit hte the following properties:

  • projectConfig: An object that holds general configurations related to Ocular (jwtSecret, cookieSecret, database_url).
  • plugins: Array of plugin configurations defining what plugins are installed and their configurations.
  • apps: Array of app configurations defining what apps are installed and their configurations.

Example:

ocular-config-xxx.js
module.exports = {
   projectConfig:{
       key1: 'value1',
       key2: 'value2'
   },
   plugins: [],
   apps: []
}

Enviroment Variables

Environment variables live in .env.local or .env.dev and can be referenced in ocular-config-xxx.js.

Set enviroment variables in the files above reference them in ocular-config-xxx.js.

projectConfig

Holds essential Ocular configurations such as DB configs,

ocular-config-xxx.js
module.exports = {
   projectConfig:{
    jwtSecret: process.env.JWT_SECRET,
    cookieSecret: process.env.COOKIE_SECRET,
    database_url: process.env.DATABASE_URL,
    database_database: process.env.DATABASE_NAME,
    database_type: "postgres",
    redis_url: process.env.REDIS_URL,
    kafka_url: process.env.KAFKA_URL,
    ui_cors: UI_CORS,
   },
   ....
}
  • jwtSecret- A random string used to create jwt auth tokens. Not required but neccessary for added security.
  • cookieSecret- A random string used to create cookie tokens. Not required but neccessary for added security.
  • database_url- Connection URL of the database. Example DATABASE_URL=postgres://postgres@localhost/ocular-db
  • redis-url- Used to specify the URL to connect to Redis
  • kafka_url- Used to specify the URL to connect to Kafka
  • ui_cors- Ocular backend API Routes are protected by Cross-Origin Resource Sharing (CORS). So, only allowed URLs or URLs matching a specified pattern can send requests to the backend’s API Routes.

plugins

Plugins add custom features to integrate with third-party services. plugins holds configurations to install plugins in Ocular.

A plugin object has the following properties:

  • resolve: Name of the plugin.
  • options: Object that includes the plugin’s options. These options vary for each plugin, and you should refer to the plugin’s documentation for available options.
core-config-xxx.js
plugins: [
   {
      resolve: `plugin-name`,
      options: {
        key: process.env.KEY || 'key',
        // other configurations
      },
    },
    ..//
]

apps

Apps add custom features to index data from third-party services. apps hold configurations to install apps in Ocular.

core-config-xxx.js
apps: [
   {
      resolve: `app-name`,
      options: {
        key: process.env.KEY || 'key',
        // other configurations
      },
    },
    ..//
]