ldsync v0.2.1

The Launch Darkly Sync Utility

The Launch Darkly Sync Utility

This utility will manage your Launch Darkly flags using a configuration file.

It will create the flags if they don't exist and then turn on/off the flags based on the status.

Installation

To install using brew on Mac or Linux:

Install ldsync

brew tap drujensen/ldsync
brew install ldsync

You will need to a Launch Darkly API access token to use this utility.

You should add this token to your shell profile or set this environment variable before using:

export LD_TOKEN="{API access token}"

Usage

To start off, we need to create a config file. The default location of the config file is: config/ldconfig.yml

Initialize config file

To create an example config file:

ldsync init

If you need to specify a different location, you will need to use the -c flag:

ldsync init -c example.yml

Here is what the config file looks like:

project: {project-key}
environment: {environment-key}
flags:
- key: example-flag
  name: Example Flag
  enabled: true

Query Projects

To see the list of all projects:

ldsync projects

Query Environments per Project

To see the list of environments for a project:

ldsync -p {project-name} envs

Query Flags per Project and Environment

To see the listt of flags per project and environment:

ldsync -p {project-key} -e {environment-key} flags

Push to Launch Darkly

After setting up the config file, you can push the changes to Launch Darkly. This will create the project, environment, flags, and value. If the resource already exists, it will skip it. Your access token will need permission to create the resources that do not already exist.

To push the changes:

ldsync push

Pull from Launch Darkly

If you make changes in Launch Darkly UI and you want to pull those changes down into the config file, you can do that will the pull command. This will replace all the flags in the config file with the ones setup in Launch Darkly. It will pull the settings based on the environment you have chosen.

To pull the changes:

ldsync pull

Enviroment Variables

There are cases where you want to override the Token, Project or Environment. You can do this using environment variables. The following environment variables are supported:

LD_TOKEN={Launch Darkly Access Token}
LD_PROJECT={Launch Darkly Project Key}
LD_ENVIRONMENT={Launch Darkly Environment Key}

Development

This was built using the Crystal Language.

To build the application:

crystal build src/ldsync.cr

To run the application:

bin/ldsync

Contributing

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

Contributors

Repository

ldsync

Owner
Statistic
  • 4
  • 1
  • 1
  • 0
  • 0
  • over 1 year ago
  • March 12, 2022
License

MIT License

Links
Synced at

Fri, 22 Nov 2024 17:24:46 GMT

Languages