All Projects → rxrc → curator

rxrc / curator

Licence: MIT License
Config curator is CLI tool for installing static configuration files.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to curator

Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (+3055.17%)
Mutual labels:  config, config-management
Config
PHP library for simple configuration management
Stars: ✭ 39 (+34.48%)
Mutual labels:  config, config-management
Assh
💻 make your ssh client smarter
Stars: ✭ 2,340 (+7968.97%)
Mutual labels:  config, config-management
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (+2117.24%)
Mutual labels:  config, config-management
Config
A lightweight yet powerful config package for Go projects
Stars: ✭ 126 (+334.48%)
Mutual labels:  config, config-management
Config
📝 Go config manage(load,get,set). support JSON, YAML, TOML, INI, HCL, ENV and Flags. Multi file load, data override merge, parse ENV var. Go应用配置加载管理,支持多种格式,多文件加载,远程文件加载,支持数据合并,解析环境变量名
Stars: ✭ 225 (+675.86%)
Mutual labels:  config, config-management
theconf
Python Package for Managing Configurations
Stars: ✭ 35 (+20.69%)
Mutual labels:  config, config-management
bem-sdk
BEM SDK packages
Stars: ✭ 83 (+186.21%)
Mutual labels:  config
dotfiles
My personal app/env configs and dotfiles.
Stars: ✭ 27 (-6.9%)
Mutual labels:  config
profig
Powerful configuration management for Scala (JSON, properties, command-line arguments, and environment variables)
Stars: ✭ 25 (-13.79%)
Mutual labels:  config
panzerlop
Configuration Guides for fixing things in Linux, Proton & KDE
Stars: ✭ 23 (-20.69%)
Mutual labels:  config
Slim-Config
A file configuration loader that supports PHP, INI, XML, JSON, and YML files for the Slim Framework. It internally uses https://github.com/hassankhan/config.
Stars: ✭ 28 (-3.45%)
Mutual labels:  config
pico
A Git-driven task runner built to facilitate GitOps and Infrastructure-as-Code while securely passing secrets to tasks.
Stars: ✭ 51 (+75.86%)
Mutual labels:  infrastructure-as-code
ha-config-ataraxis
My Home Assistant Configs. If you like what you see, please ⭐️my repo. It would encourage me a lot 🤘
Stars: ✭ 146 (+403.45%)
Mutual labels:  config
goodconf
Transparently load variables from environment or JSON/YAML file.
Stars: ✭ 80 (+175.86%)
Mutual labels:  config
neovim-config
Modern NeoVim config for IDE-like development
Stars: ✭ 89 (+206.9%)
Mutual labels:  config
rubric
Linter Config Initializer for Python
Stars: ✭ 21 (-27.59%)
Mutual labels:  config
cdk-collections
AWS Infra as Code(akka. AWS CDK) example collections
Stars: ✭ 19 (-34.48%)
Mutual labels:  infrastructure-as-code
eslint-define-config
Provide a defineConfig function for .eslintrc.js files
Stars: ✭ 61 (+110.34%)
Mutual labels:  config
yaask
Make your yaml configurable with interactive configurations!
Stars: ✭ 15 (-48.28%)
Mutual labels:  config

☄️ Config Curator

npm github

CLI tool for installing static configuration or dotfiles.

Description

  • 🦉 Idempotent: syncs directories, copies files, creates system links, deletes paths, and sets access permissions to ensure the system will be in a consistent state after each run.
  • 🐬 Declarative: all operations are defined in a manifest file with a simple syntax.
  • 🐍 Flexible: operations may be limited only to specific hosts or only when specific packages are installed, additionally, since the manifest is written in JavaScript, it may include arbitrary logic.
  • 🐹 Minimal: written in < 500 lines of code using only the Node.js standard library and a few system calls.
  • 🐡 Secure: no additional third party dependencies (except rsync): safe to run with sudo to install system files.
  • 🦅 Fast: uses maximal concurrency and allows custom ordering of groups of operations.

Try it out

  1. Clone this repo.
  2. Run npm install.
  3. Run npm test: This will install the configuration defined in test/manifest.js to test/dest.

Requirements

  • Linux or macOS with rsync installed.
  • Node.js version 8 or above.
  • For conditional configuration based on installed packages, the following package managers are supported: Pacman, Homebrew, dpkg, or pkgng.

Installation

  1. Add this as a development dependency to your project using npm with

    $ npm install --save-dev @rxrc/curator
    
  2. Add a script to your package.json with "curator": "curator" so you may run this with

    $ npm run curator
    

Usage

Create a manifest.js file to define the configuration and run the curator command to install the configuration.

  • The manifest configuration is defined below. Copy the example manifest from manifest.example.js.
  • The manifest should be the default export and may be an object, function, promise, or async function.
  • The location of the manifest file may be passed as the first argument, otherwise it looks for manifest.js in the current working directory.
  • The environment variables CURATOR_IO and CURATOR_PKG may be set to override the ioType and pkgType values from the manifest.

Manifest

Minimal example

/* manifest.js */

'use strict'

const os = require('os')

const targetRoot = os.homedir()

const unlinks = [{
  src: 'old.conf'
}]

const directories = [{
  src: '.config/envs'
}, {
  src: 'vim',
  dst: '.vim'
}, {
  src: 'private',
  dmode: '0700',
  fmode: '0600',
  user: 'root',
  group: 'wheel'
}]

const files = [{
  src: '.zshrc'
}, {
  src: `keys/${os.hostname()}`,
  dst: '.ssh/id_rsa',
  fmode: '0600',
  pkgs: ['openssh']
}]

const symlinks = [{
  src: '.config/env.conf',
  dst: '.config/envs.${os.hostname()}.conf',
  hosts: ['alpha', 'delta']
}]

module.exports = {targetRoot, unlinks, directories, files, symlinks}

Complete manifest API

/* manifest.js */

'use strict'

/* Prefix for all source paths
 * except for unlinks and symlinks which use targetRoot below.
 *
 * Use __dirname to refer to the location of this file
 * and process.cwd() for the current working directory.
 *
 * Default: the current working directory.
 */
const originRoot = require('os').homedir()

/* Prefix for all destination paths.
 * For unlinks and symlinks, the source is also prefixed.
 *
 * Use __dirname to refer to the location of this file
 * and process.cwd() for the current working directory.
 *
 * Default: a ./dest folder under the current working directory.
 */
const targetRoot = require('os').homedir()

/* Package lookup backend to use:
 * pacman, dpkg, homebrew, pkgng, or noop.
 *
 * The special value noop will assume all packages are installed.
 *
 * Default: attempt to autodetect, fallback to noop.
 */
const pkgType = 'homebrew'

/* I/O backend to use:
 * linux, macos, or noop.
 *
 * The special value noop will not perform any modifications
 * and only log what actions would be taken.
 *
 * Default: attempt to autodetect, fallback to noop.
 */
const ioType = 'macos'

/* Defaults to use for each operation.
 *
 * Default: shown below.
 */
const defaults = {
  order: 100, // all operations start with this order value
  dmode: '0750', // files have user write, group read, other no access
  fmode: '0640', // directories have user write, group read, other no access
  user: process.getuid(), // current user
  group: process.getgid() // current group
}

/* Operations to perform by type.
 *
 * Operations always happen in this order: unlinks, directories, files, and symlinks.
 *
 * Each type of operations waits until the previous type has completed successfully.
 *
 * Operations of each type with equal order value are always done in parallel,
 * but operations with a later order do not start until earlier ones complete.
 *
 * Specifying an array of hostnames will restrict that
 * operation to matching hosts (case insensitive).
 *
 * Specifying an array of packages will restrict that
 * operation to hosts with all packages installed (case insensitive).
 *
 * All operation types will default to an empty array if unset.
 */

/* Unlink (unconditionally remove) the directory, file, or symlink at src.
 *
 * The src is relative to the global targetRoot option.
 */
const unlinks = [{
  // Remove ~/intruders on all hosts.
  src: 'intruders'
}, {
  // Remove ~/warpcore on host enterprise, if the eject package is installed.
  src: 'warpcore',
  hosts: ['enterprise'],
  pkgs: ['eject']
}]

/* Synchronize the contents of the directory at src to dst
 * and sets the directory and file permissions.
 *
 * The src is relative to the global originRoot option.
 * The dst is relative to the global targetRoot option.
 *
 * NOTE: this WILL remove files in dst that are not in src.
 *
 * If dst is not given, will use src as the subpath.
 */
const directories = [{
  // Synchronize ./holodeck to ~/holodeck on all hosts.
  src: 'holodeck'
}, {
  // Synchronize ./panels/exploding to ~/bridge/panels
  // on hosts enterprise and defiant,
  // if the turbolift and transporter packages are installed,
  // and set specific user, group, and access permissions.
  src: 'panels/exploding',
  dst: 'bridge/panels',
  user: 'numberone',
  group: 'officers',
  dmode: '0755',
  fmode: '0644',
  hosts: ['enterprise', 'defiant'],
  pkgs: ['turbolift', 'transporter']
}, {
  // Install sickbay first, then install the beds and meds.
  src: 'decks/sickbay',
  dst: 'sickbay',
  order: 10
}, {
  src: 'beds',
  dst: 'sickbay/beds',
  order: 11
}, {
  src: 'meds',
  dst: 'sickbay/meds',
  order: 11
}]

/* Copy the file at src to dst
 * and sets the file permissions.
 *
 * The src is relative to the global originRoot option.
 * The dst is relative to the global targetRoot option.
 *
 * NOTE: this WILL replace the file at dst.
 *
 * If dst is not given, will use src as the subpath.
 */
const files = [{
  // Copy ./bay/torpedo to ~/bay/torpedo on all hosts.
  src: 'bay/torpedo'
}, {
  // Copy ./phaser to ~/brig/phaser
  // on host defiant, if the stun package is installed,
  // and set the user, group, and access permissions.
  src: 'phaser',
  dst: 'brig/phaser',
  user: 'warf',
  group: 'security',
  fmode: '0600',
  hosts: ['defiant'],
  pkgs: ['stun']
}]

/* Create a system link (symlink) at src pointing to dst.
 *
 * The src and dst are relative to the global targetRoot option.
 *
 * NOTE: this WILL replace the file at src.
 */
const symlinks = [{
  // Create a symlink from ~/drink to ~/tea/earlgray/hot on all hosts.
  src: 'drink',
  dst: 'tea/earlgray/hot'
}, {
  // Create a symlink from ~/hypospray to ~/hyposprays/norepinephrine
  // on host enterprise if the sickbay package is installed.
  src: 'hypospray',
  dst: 'hyposprays/norepinephrine',
  hosts: ['enterprise'],
  pkgs: ['sickbay']
}]

/* Export each value set above.
 * The export may be a plain object as below, or a function, promise,
 * or async function that returns the plain object.
 * Simply do not export an option to use the default.
 */
module.exports = {
  unlinks,
  directories,
  files,
  symlinks,
  originRoot,
  targetRoot,
  ioType,
  pkgType,
  defaults
}

Similar Software

This is the successor to my original configuration tool written in Ruby: https://github.com/razor-x/config_curator.

GitHub maintains an unofficial guide to dotfiles: https://dotfiles.github.io/.

Users

If you are using Config Curator, add a link here and open a pull request.

Contributing

Please submit and comment on bug reports and feature requests.

To submit a patch:

  1. Fork it (https://github.com/rxrc/curator/fork).
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Make changes.
  4. Commit your changes (git commit -am 'Add some feature').
  5. Push to the branch (git push origin my-new-feature).
  6. Create a new Pull Request.

License

This npm package is licensed under the MIT license.

Warranty

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

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].