@aftonbladet/sidecare

JavaScript sidecar helper for communicating with a Prana style sidecar app

Usage no npm install needed!

<script type="module">
  import aftonbladetSidecare from 'https://cdn.skypack.dev/@aftonbladet/sidecare';
</script>

README

Sidecare

Build Status

JavaScript sidecar helper for communicating with a Prana style sidecar app

Usage

npm install @aftonbladet/sidecare --save

Configuration

To get a configuration value from the configuration server:

import get from '@aftonbladet/sidecare';

(async () => {
    console.log('Configuration value for "foo.bar"', await get('foo.bar'));
})();

The key passed along to get will be translated into an environment variable by replacing all .s with _s and uppercasing it (e.g FOO_BAR). If the environment variable is not found the configuration server value with the exact key (e.g foo.bar) will be returned. If no configuration is found, undefined is returned. Environment variables wrapped in brackets will be converted to arrays (split by comma).

It will use the environment variable BOXFUSE_APP as service and BOXFUSE_ENV as profile (along with default.

Developing

  1. Optional step (if not logged in already): ./npm login --registry=https://registry.npmjs.org/ --scope=@aftonbladet
  2. npm install

Release and Publish

Every push to master will result in a new patch release being tagged and published on npmjs.org.

If you want to bump the minor or major version, just use the npm version command as you please. The version will be tagged and pushed automatically and Travis will publish it on npmjs.org.

E.g if you are on version 1.0.4 and run:

npm version minor

Travis will publish 1.1.0 on npmjs.org for you.