All Projects → tadatuta → Betterc

tadatuta / Betterc

Like rc but better ;)

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Betterc

Xxl Conf
A lightweight distributed configuration management platform. (分布式配置管理平台XXL-CONF)
Stars: ✭ 619 (+5527.27%)
Mutual labels:  config
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (+7500%)
Mutual labels:  config
Debian Server
Complete Debian/Ubuntu Web Application Server Installation
Stars: ✭ 22 (+100%)
Mutual labels:  config
Universal
Seed project for Angular Universal apps featuring Server-Side Rendering (SSR), Webpack, CLI scaffolding, dev/prod modes, AoT compilation, HMR, SCSS compilation, lazy loading, config, cache, i18n, SEO, and TSLint/codelyzer
Stars: ✭ 669 (+5981.82%)
Mutual labels:  config
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+6800%)
Mutual labels:  config
Wlh Dotfiles
my dotfiles
Stars: ✭ 18 (+63.64%)
Mutual labels:  config
Go Config
A dynamic config framework
Stars: ✭ 595 (+5309.09%)
Mutual labels:  config
Awesome Hammerspoon
awesome configuration for Hammerspoon.
Stars: ✭ 928 (+8336.36%)
Mutual labels:  config
V2ray Examples
v2ray-core 的模板们
Stars: ✭ 778 (+6972.73%)
Mutual labels:  config
Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (+8218.18%)
Mutual labels:  config
Tslint To Eslint Config
Converts your TSLint configuration to the closest possible ESLint equivalent. 🚀
Stars: ✭ 680 (+6081.82%)
Mutual labels:  config
Wordpress Multi Env Config
WordPress Multi-Environment Config
Stars: ✭ 743 (+6654.55%)
Mutual labels:  config
Exhibit
Exhibit is a managed screensaver App for tvOS.
Stars: ✭ 19 (+72.73%)
Mutual labels:  config
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (+5745.45%)
Mutual labels:  config
Configuron
Clojure(Script) config that reloads from project.clj when in dev mode
Stars: ✭ 24 (+118.18%)
Mutual labels:  config
Konfig
Composable, observable and performant config handling for Go for the distributed processing era
Stars: ✭ 597 (+5327.27%)
Mutual labels:  config
Qonfig
Config. Defined as a class. Used as an instance. Lazy instantiation. Validation layer. Thread-safe. Support for YAML, TOML, JSON, __END__, ENV. Extremely simple to define. Extremely simple to use.
Stars: ✭ 17 (+54.55%)
Mutual labels:  config
Atom Modular Snippets
:atom: A modular solution to snippets in @Atom.
Stars: ✭ 8 (-27.27%)
Mutual labels:  config
Home Assistant Config
Home Assistant config files, rewritten to use the latest features, 100+ documented automations, automatically generated ToC 🏠 🤖
Stars: ✭ 926 (+8318.18%)
Mutual labels:  config
Mrm
Codemods for your project config files
Stars: ✭ 900 (+8081.82%)
Mutual labels:  config

betterc

Like rc but better ;)

Searches for configs and returns an array of all configs found.

Installation

npm i betterc

Usage

var betterc = require('betterc');
betterc({ name: 'appname' });
betterc.sync({ name: 'appname' });

Given your application name (appname), betterc will look in all the obvious places for configuration:

  • the defaults object you passed in
  • $HOME/.${appname}rc
  • $HOME/.${appname}/config
  • $HOME/.config/${appname}
  • $HOME/.config/${appname}/config
  • a local .${appname}/config and .${appname}rc and all found looking in ./ ../ ../../ ../../../ etc.
  • if you passed environment variable ${appname}_config then from that file
  • if you passed an option --config file then from that file
  • environment variables prefixed with ${appname}_
    • or use "__" to indicate nested properties
      (e.g. appname_foo__bar__baz => foo.bar.baz)

All config files may have or have not json or js extentions in following order:

[
  `.${appname}rc`,
  `.${appname}rc.json`,
  `.${appname}rc.js`
]

All configuration sources that were found will be added to result array.

Advanced usage

var betterc = require('betterc');

betterc({ // or betterc.sync for sync version
    name: 'appname',

    cwd: 'current-working-directory',
    argv: {
        config: 'path-to-config'
    },

    fsRoot: '/my-root',     // custom '/' directory, used in tests
    fsHome: '/my-home',     // custom $HOME directory, used in tests

    // initial config to be extended by all the others
    defaults: {
        foo: 'baz'
    },

    // config which will override all the others
    extendBy: {
        foo: 'will-override-baz'
    }
});

Configuration file format

Configuration files (e.g. .appnamerc) may be in json or CommonJS module format:

JSON

{
  "dependsOn": "0.10.0",
  "commands": {
    "www": "./commands/www",
    "console": "./commands/repl"
  },
  "generators": {
    "options": {
      "engine": "ejs"
    },
    "modules": {
      "new": "generate-new",
      "backend": "generate-backend"
    }
  }
}

CommonJS

module.exports = {
  "dependsOn": "0.10.0",
  "commands": {
    "www": "./commands/www",
    "console": "./commands/repl"
  },
  "generators": {
    "options": {
      "engine": "ejs"
    },
    "modules": {
      "new": "generate-new",
      "backend": "generate-backend"
    }
  }
};

Since env variables do not have a standard for types, your application needs be prepared for strings.

License

Licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].