ucm

module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: Apache-2.0

README ยถ

โš™๏ธ Universal Configs Manager

The ucm utility quickly switches multiple dev configs with a single command.

Manages: hosts file entry, Git config, Node version, Node repository, environment variables, etc.

Go Report Card Build

๐Ÿ˜ฎ How it works

If you work on different projects requiring different environment you can change all of your settings with a single CLI command.

Like that:

> ucm ls
Universal Configs Manager:
  - personal
  - work     <= current

> ucm
Configured [work]:
  - Git config
    - user.email: my@work.email
  - Node version:    10.2.1
  - Node Repository:  work => https://registry.work.example.com/
  - Environment variables:
    - HTTP_PROXY: http://proxy.work.example.com

> ucm use --name personal
Configured [personal]:
  - Git config
    - user.email: my@personal.email
  - Node version:    15.6.1
  - Node Repository:  npm => https://registry.npmjs.org/
  - Environment variables:
    - HTTP_PROXY: (none)

There is a dedicated page about available command.

Pitfalls & known issues
  • Environment variables โ€” Originally it was planned to perform changing of env vars in a shell the UMC has been run. Unfortunately it does not look to be possible without gdb hack and this seems to be too difficult, dangerous & unstable. As an alternative we can output to console a script for setting env vars that user should copy-paste and execute manually. This is not ideal but still good enough as information is easily available & quick to use.

๐Ÿ“ฆ Supports out of the box

  • Environment variables
  • Git configuration
  • NVM - Node Version Manager
  • NRM - Node Repository Manager

Ideas & contributions are welcome on how to make it expandable.

๐Ÿ“ค Shared config profiles

A named configs profile can point to a file in a shared folder or URL. This way you can share configuration with your team.

 > umc add --url https://example.com/my-team/.ucm.prod.yaml --name work-prod
 > umc add --path //shared_folder/.ucm.test.yaml --name work-test --sync auto
๐Ÿ”› Sync options
  • ask - ask to update if changed (default)
  • auto - auto update if changed
  • none - do not check for updates
Can take setting from a file

Can apply settings stored inside your project in a .universal-configs.yaml file.

~/projects/> ucm use --file ./some-project/.universal-configs.yaml
Configured [work]:
  - Git config
    - user.email: my@work.email
Configured [~/projets/some-project/.universal-configs.yaml]:
  - Node version:    10.2.1
  - Node Repository:  work => https://registry.work.example.com/
  - Environment variables:
    - HTTP_PROXY: http://proxy.work.example.com

โš–๏ธ Compare config differences

> ucm diff --file http://example.com/some-company.yaml --name personal
Compared:
  - File:  http://example.com/some-company.yaml
  - Named: personal
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ โ†“ Configs / Profiles โ†’ โ”‚ some-company.yaml โ”‚  personal         โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ Git config             โ”‚                   โ”‚                   โ•‘
โ•‘   - user.email         โ”‚ (none)            โ”‚ my@personal.email โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ Enviroment vars        โ”‚                   โ”‚                   โ•‘
โ•‘   - HTTP_PROXY         โ”‚ http://proxy      โ”‚ (none)            โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿ’ก Ideas & Suggestions

If you have an idea on what can be added to UCM please start a discussion first before opening an issue.

๐Ÿ’ป Cross platform: Works on Windows, Linux, MacOS

Developed in Go language so it's fast and works on any OS suported by Go.

๐Ÿ“ฅ Install & Downloads

You can install from sources or download binaries.

Installing from sources
> go get github.com/sneat-team/universal-configs-manager
> cd universal-configs-manager
> go install cli/ucm/ucm.go
Download binaries

Not available yet.

Installing using package managers

Not available yet.

๐Ÿ† Contributions

Contributors wanted, PRs are welcome.

There is a roadmap document that outlines plans & ideas.

Getting source codes & Building locally

To get source codes:

> git clone https://github.com/sneat-team/universal-configs-manager.git
> cd universal-configs-manager

To build an executable file run:

> go build cli/ucm/ucm.go 

This will generate the ucm executable in the current directory (ucm.exe on Windows).

๐Ÿค” Questions at StackOverflow

Here is a list of questions we've asked at StackOverflow while developing this little utility.

๐Ÿคฉ Credits

This project would not be possible without using free & open source.

  • Developed in Go language
Go packages used by this project

โœ’๏ธ License

This is free & open source utility licensed under Apache License version 2.0.

Directories ยถ

Path Synopsis
cli
ucm command
packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL