Properties Volume to Nodejs Property Integration

Properties Volume to Nodejs Property Integration

properties-volume-nodejs .This module is to incorporate the integration of the Azure key-vault flex volume to node properties.

properties-volume-nodejs

This module is to incorporate the integration of the Azure key-vault flex volume to node properties.

Usage

This module adds the properties volume entries into the configuration object from 'config' We use the default mount point of /mnt/ volume, which happens exposes the key vault in chart-nodejs.

We use the last folder of the mount point, secrets, to map the properties into the configuration.

Below is an example:

{
 "secrets": {
   "VAULT": {
     "secretOne": "VALUE",
     "some-secret-two": "VALUE"
   },
   "VAULT2": {
     "secretOne": "VALUE",
     "some-secret-two": "VALUE"
   }
 }
}

NOTE

  • The property names are not sanitised and are an exact copy from the file names on volume. This means when using the hmcts/nodejs helm chart the property naming is exactly the same as those in the key vault.

  • Application property defaults can be added to your application configuration for the config package using the same object structure.

    e.g To add a default for the property secrets.cmc.staff-email we would add the following to the configuration.

    in JSON:

    {
      "secrets": {
        "cmc": {
          "staff-email": "DEFAULT_EMAIL"
        }
      }
    }

    or in yaml

    secrets:
       cmc:
         staff-email: DEFAULT_EMAIL
    
  • If you have the need to add a test or add multiple property volumes in one application you can override the volume mount point. To do this we can supply a value for the defaulted volume folder in the api i.e addTo( config, {mountPoint:'some/other/folder/secrets'}).

  • The last folder name is used as the prefix for the properties in the configuration e.g. /mnt/secrets the properties start with secrets, /mnt/certs the properties start with certs.

  • If you mount volumes with the same last folder name e.g /mnt/super/secrets and /mnt/silly/secrets the properties will be fully merged together into the configuration object under secrets and the last property volume that is merged in will override any properties with the same name.

Quick start

$ yarn add @hmcts/properties-volume

Typescript

import * as config from 'config'
import * as propertiesVolume from '@hmcts/properties-volume'
propertiesVolume.addTo(config)

Javascript

config = require('@hmcts/properties-volume').addTo(require('config'))

Options

The properties volume can be supplied with a couple of options via a js like options object. e.g.

const config = require('@hmcts/properties-volume').addTo(require('config'),{mountPoint:'some/properties/mount/point'})
Option Description Default
mountPoint the folder where the properties volume exists. /mnt/secrets/
failOnError Should this module throw an exception if mount does not exist or there is an error reading the properties false

Download Details:

Author: hmcts

Source Code: https://github.com/hmcts/properties-volume-nodejs

node nodejs javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Node canvas is a Cairo backed Canvas implementation for NodeJS.

node-canvas is a Cairo-backed Canvas implementation for Node.js.

How to Hire Node.js Developers And How Much Does It Cost?

A Guide to Hire Node.js Developers who can help you create fast and efficient web applications. Also, know how much does it cost to hire Node.js Developers.

Hire NodeJs Developer

Looking to build dynamic, extensively featured, and full-fledged web applications? **[Hire NodeJs Developer](https://hourlydeveloper.io/hire-dedicated-node-js-developer/ "Hire NodeJs Developer")** to create a real-time, faster, and scalable...

Decoding Nodejs

The main goal of this blog is to explain the “Architecture of Nodejs” and to know how the Nodejs works behind the scenes. Generally, most of the server-side languages, like PHP, ASP.NET, Ruby, and including Nodejs follows multi-threaded architecture. That means for each client-side request initiates a new thread or even a new process.

Node.js for Beginners - Learn Node.js from Scratch (Step by Step)

Node.js for Beginners - Learn Node.js from Scratch (Step by Step) - Learn the basics of Node.js. This Node.js tutorial will guide you step by step so that you will learn basics and theory of every part. Learn to use Node.js like a professional. You’ll learn: Basic Of Node, Modules, NPM In Node, Event, Email, Uploading File, Advance Of Node.