1.3.1 • Published 4 years ago

@splytech-io/config v1.3.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
4 years ago

config

this package includes following npm packages

  • config
  • js-yaml
  • joi

Interface

new Config(rules: any, path?: string)

Sample usage

# config/default.yml

healthz:
  port: 7020

Full configuration

import { Config, J } from '@splytech-io/config';

interface Schema {
  healthz: {
    port: number;
  };  
}

const config = new Config<Schema>({
  healthz: {
    port: J.number(),
  },
});


// throws an error if configuration is invalid
config.validate();

console.log(config.get().healthz.port); // - 7020

Partial configuration

import { Config, J } from '@splytech-io/config';


interface Schema {
  port: number;
}

const rules = {
  port: J.number(),
};

const config = new Config<Schema>(rules, 'healthz')
  .validate()
  .get();

console.log(config.port); // - 7020
1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

2.0.0-beta.1

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago