Skip to content

⚙️ quickly switches config settings with a single command (Git, hosts, Node, env vars, etc.)

License

Notifications You must be signed in to change notification settings

sneat-co/universal-configs-manager

Repository files navigation

⚙️ 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: [email protected]
  - Node version:    10.2.1
  - Node Repository:  work => https://registry.work.example.com/
  - Environment variables:
    - HTTP_PROXY: https://proxy.work.example.com

> ucm use --name personal
Configured [personal]:
  - Git config
    - user.email: [email protected]
  - 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: [email protected]
Configured [~/projets/some-project/.universal-configs.yaml]:
  - Node version:    10.2.1
  - Node Repository:  work => https://registry.work.example.com/
  - Environment variables:
    - HTTP_PROXY: https://proxy.work.example.com

⚖️ Compare config differences

> ucm diff --file https://example.com/some-company.yaml --name personal
Compared:
  - File:  https://example.com/some-company.yaml
  - Named: personal
╔════════════════════════╤═══════════════════╤═══════════════════╗
║ ↓ Configs / Profiles → │ some-company.yaml │  personal         ║
╟────────────────────────┼───────────────────┼───────────────────╢
║ Git config             │                   │                   ║
║   - user.email         │ (none)            │ [email protected] ║
╟────────────────────────┼───────────────────┼───────────────────╢
║ Enviroment vars        │                   │                   ║
║   - HTTP_PROXY         │ https://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.

About

⚙️ quickly switches config settings with a single command (Git, hosts, Node, env vars, etc.)

Topics

Resources

License

Stars

Watchers

Forks

Languages