1.1.0 • Published 24 days ago

properties-manager-js v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
24 days ago

Local properties manager

Introduction

properties-manager is a tool to open properties files in local applications. This allows you to have several general configuration files and configurations for rest clients separated by runtime environment. The tool will take the corresponding file depending on the execution environment in which it is located.

Installation

To install the library, use the following command:

npm install properties-manager

Usage

getConfigFile

Note: Default without environment variable

./config/dev.default.json

{
    "test_key": "test_value"
}
 const config = getConfigFile();
 console.log(config.test_key)

Note: Custom without environment variable

./config/dev.custom.json

{
    "test_key": "test_value"
}
 const config = getConfigFile('custom');
 console.log(config.test_key)

Note: Default with environment variable

./config/prod.default.json

{
    "test_key": "test_value"
}

ENVIRONMENT=prod

 const config = getConfigFile();
 console.log(config.test_key)

Note: Custom with environment variable

./config/prod.custom.json

{
    "test_key": "test_value"
}

ENVIRONMENT=prod

 const config = getConfigFile('custom');
 console.log(config.test_key)

getRestClientFile

Note: Default without environment variable

./config/dev.rest_client.json

{
    "test_key": "test_value"
}
 const config = getRestClientFile();
 console.log(config.test_key)

Note: Default with environment variable

./config/prod.rest_client.json

{
    "test_key": "test_value"
}

ENVIRONMENT=prod

 const config = getRestClientFile();
 console.log(config.test_key)

Contributions

If you wish to contribute to the library, please feel free to create a fork and pull request

1.1.0

24 days ago