Skip to content

hackmdio/config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@hackmd/config Build Status

This project is a configuration management tool for HackMD.

It inspired by 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
{ "name": "example-project", "dependencies": { "@hackmd/config": "0.0.1-alpha.1" }, "config": { "type": "./config/type.js", "reader": [ "file:./config/default.js", "env:APP" ] } } 
  1. Define your config type
module.exports = { host: String, port: Number, db: { host: String, port: String, user: String, pass: String, }, allowHost: Array }
  1. initialize @hackmd/config before your program
const config = require('@hackmd/config') await config.buildAsync() main();
  1. in your program, you can use require('@hackmd/config').getConfig() to get your config object

About

A configuration management tool for HackMD

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published