0.5.4 • Published 4 years ago

@bpnet/unicon v0.5.4

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

##Table of contents

##Installation Run npm install --save @bpnet/unicon or npm i -S @bpnet/unicon

##Quick start Import Configuration class definition into your main module file of the project - index.js for example.

import {Configuration} from "@bpnet/unicon"

Create configuration instance:

// Set "esModuleInterop": true in your tsconfig.json to allow ES6 imports
import path from 'path';
// Don't forget add "resolveJsonModule": true to your tsconfig.json
import * as Schema from './schemas/ValidationSchema.json';
import {Configuration} from "@bpnet/unicon"

// Create configuration object
const cfg = new Configuration({
    validationSchema: Schema
});

// Load config from file system
cfg.load(path.join(__dirname, 'samples/Configuration.json'));
// or from web using URL
cfg.load(path.join(__dirname, 'https://sample-server.com/configs/&token=abcdabcd123123'));

// Check that your config is valid
if (cfg.valid) {
    // Get something from configuration using JSONPath syntax
    const configVersion = cfg.get('$.header.version');
    ...
}

That's all that you need to use Universal Configuration.

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago