ExtensionEngine / tailor

Content authoring platform
MIT License
31 stars 10 forks source link

Feature: Enable adding environment variables for TCE server hooks #716

Closed ikovac closed 3 years ago

ikovac commented 3 years ago

❗ This PR introduces a way of declaring TCE env variables. The TCE env variables should be prefixed with TCE in .env file.

Example:

  1. Declare TCE env variable inside .env file
    
    // .env file

TCE_BRIGHTCOVE_VIDEO_API_KEY=myapikey


2. Declared env variable can be found inside config object in `tce` namespace. Env variable is converted to [camelCase](https://lodash.com/docs/4.17.15#camelCase) and the `TCE` prefix is dropped.
```js
const config = require('config/server');

console.log(config.tce.brightcoveVideoApiKey); // Prints "myapikey"
  1. TCE HOOKS example
    
    // tce-brightcove-video/server/index.js

function beforeSave(asset, { config }) { console.log(config.tce.brightcoveVideoApiKey); // Prints "myapikey" return asset; }

underscope commented 3 years ago

🎖️