EnSync CLI Tool
A command-line interface for interacting with the EnSync config management service.
Table of Contents
Installation
Download the CLI Tool
Choose the correct download command for your platform.
Extract the Downloaded Archive
For `.zip` files, right-click the file and select **Extract All**, or use `7zip`:
Make the Binary Executable (macOS/Linux)
After extracting, make the binary executable (only for macOS/Linux):
Move the Binary to a Directory in Your PATH
To make the `ensync-cli` command accessible globally, move it to a directory included in your `PATH`.
- macOS/Linux
- sudo mv ensync-cli /usr/local/bin/
- Windows
Move the `ensync-cli.exe` binary to a folder (e.g., `C:\Program Files\CLI\`) and add that folder to your `PATH` environment variable.
Steps to update PATH on Windows:
Open the Start Menu, search for "Environment Variables," and select "Edit the system environment variables."
In the System Properties window, click on the "Environment Variables" button.
Under "System variables," find and select the `Path` variable, then click "Edit."
Click "New," and add the folder where you placed `ensync-cli.exe` (e.g., `C:\Program Files\CLI\`).
Click "OK" to save your changes and close all dialogs.
Verify the Installation
Confirm the tool was installed successfully by checking the version:
This should output the version of the CLI tool that was installed.
If you have Go installed, you can install EnSync CLI directly using the `go install` command:
To install a specific version:
To install the latest version:
Notes:
Configuration/Initial Setup
macOS/Linux
To simplify the configuration, add the environment variables to your shell configuration file:
Open your shell configuration file (e.g.,
~/.bashrc
,~/.zshrc
, or~/.bash_profile
):nano ~/.bashrcAdd the following lines:
export ENSYNC_BASE_URL="http://localhost:8080/api/v1/ensync" # EnSync's config manager is hosted on port 8080 by default export ENSYNC_DEBUG=falseSave the file and apply the changes:
source ~/.bashrc
Windows
To set up environment variables on Windows:
Open the Start Menu, search for "Environment Variables," and select "Edit the system environment variables."
In the System Properties window, click on the "Environment Variables" button.
Under "System variables," click "New," and create two variables:
Variable Name:
ENSYNC_BASE_URL
Variable Value:http://localhost:8080/api/v1/ensync
Variable Name:
ENSYNC_DEBUG
Variable Value:false
Click "OK" to save the variables, then close all dialogs.
Open a new Command Prompt or PowerShell window to apply the changes.
Environment Variables
Alternatively, you can configure the CLI using environment variables:
Usage
Event Management
List Events
Example 2
Create Event
Update Event
Example 3
Access Key Management
List Access Keys
Create Access Key
Set Permissions
Get Permissions
General Options
Debug Mode
Version Information
Common Flags
--page
: Page number for pagination (default: 0)--limit
: Number of items per page (default: 10)--order
: Sort order (ASC/DESC)--order-by
: Field to sort by (name/createdAt)--debug
: Enable debug mode--config
: Specify custom config file location
Error Handling
Exit code
0
: SuccessExit code
1
: General errorExit code
2
: Configuration errorExit code
3
: API error
Troubleshooting
Permission Issues:
On macOS/Linux, you might need
sudo
to move the binary to a directory like/usr/local/bin
.On Windows, ensure you have the necessary permissions to modify the
PATH
and place the binary in the appropriate folder.
Command Not Found: If the
ensync-cli
command doesn't work after installation, ensure that the binary is in yourPATH
and check the system's environment variables.Access Key Errors: If you encounter errors related to the
accessKey
, ensure that:The
accessKey
is provided via the--access-key
flag.The
accessKey
is valid and has the necessary permissions.
Conclusion
The CLI tool can be installed using curl
and configured with either a configuration file, environment variables, or command-line flags. The accessKey
is now required for all API interactions, and this guide provides instructions for installation and configuration across various platforms.