Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hackmdio/config
A configuration management tool for HackMD
https://github.com/hackmdio/config
configuration-management hackmd nodejs wip-do-not-use
Last synced: about 1 month ago
JSON representation
A configuration management tool for HackMD
- Host: GitHub
- URL: https://github.com/hackmdio/config
- Owner: hackmdio
- License: mit
- Created: 2019-04-15T09:50:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T23:33:44.000Z (over 3 years ago)
- Last Synced: 2024-11-11T08:15:13.957Z (about 1 month ago)
- Topics: configuration-management, hackmd, nodejs, wip-do-not-use
- Language: TypeScript
- Size: 18.6 KB
- Stars: 1
- Watchers: 7
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @hackmd/config [![Build Status](https://travis-ci.org/hackmdio/config.svg?branch=master)](https://travis-ci.org/hackmdio/config)
This project is a configuration management tool for HackMD.
It inspired by [node-config](https://github.com/lorenwest/node-config).
## Introduction
@hackmd/config is a tool to manage mass configuration source,
such as config file, environment, or docker secret.We use config-provider to load difference config source.
The config-provider is a plugin for @hackmd/config.## How to use?
1. You must setup which config type and config loaded order in your `package.json`
```json
{
"name": "example-project",
"dependencies": {
"@hackmd/config": "0.0.1-alpha.1"
},
"config": {
"type": "./config/type.js",
"reader": [
"file:./config/default.js",
"env:APP"
]
}
}```
2. Define your config type
```js
module.exports = {
host: String,
port: Number,
db: {
host: String,
port: String,
user: String,
pass: String,
},
allowHost: Array
}
```3. initialize `@hackmd/config` before your program
```js
const config = require('@hackmd/config')await config.buildAsync()
main();
```
4. in your program, you can use `require('@hackmd/config').getConfig()` to get your config object