SDKs overview
MicroENV provides tools to manage and distribute environment variables and secrets securely across development, staging, and production environments. The core of its programmatic interface is the MicroENV Command Line Interface (CLI), which allows developers to interact with the MicroENV Cloud Dashboard and its features directly from the terminal or within automated scripts. While MicroENV does not offer traditional language-specific SDKs in the manner of a REST API wrapper for every programming language, its CLI is designed to be language-agnostic, making it integratable into any development workflow or CI/CD pipeline that can execute shell commands.
The CLI enables operations such as fetching secrets, setting environment variables, managing projects, and controlling access. This approach simplifies the distribution and updating of sensitive configuration data, ensuring that applications always run with the correct and most up-to-date environment settings without hardcoding secrets into repositories. For broader context on managing configuration securely, Google Cloud's secrets management best practices offer a foundational understanding of the principles MicroENV addresses.
Official SDKs by language
MicroENV's primary official SDK is its CLI, which serves as the main interface for programmatic interaction. This design choice prioritizes a unified experience across different programming languages and environments, as the CLI can be invoked from any script or application capable of executing system commands. As such, there are no separate SDKs for languages like Python, Node.js, or Java; instead, developers integrate the CLI into their respective language's build or deployment scripts.
The table below summarizes the official SDK offering:
| Language/Platform | Package/Tool | Maturity | Description |
|---|---|---|---|
| Language-agnostic | MicroENV CLI | Stable (V1.x) | Official command-line interface for managing secrets, projects, and environments. Integrates with shell scripts, CI/CD pipelines, and local development setups. |
Installation
Installing the MicroENV CLI is a straightforward process, supported across various operating systems. The recommended method ensures that the CLI is properly configured for use in both development environments and CI/CD pipelines. For detailed, platform-specific instructions, refer to the official MicroENV CLI installation guide.
macOS & Linux
On macOS and Linux systems, the MicroENV CLI can typically be installed using a one-liner script:
curl -fsSL https://install.microenv.com/cli | sh
This command downloads and executes the installation script, which places the microenv binary in a location accessible by your system's PATH. After installation, it's recommended to restart your terminal or source your shell configuration file to ensure the new PATH is recognized.
Windows
For Windows users, MicroENV provides an executable installer or supports installation via package managers like Scoop or Chocolatey. The official documentation provides direct download links for the latest Windows installer. Alternatively, using PowerShell:
iwr -useb https://install.microenv.com/cli.ps1 | iex
This PowerShell script handles the download and setup of the MicroENV CLI. Administrators may need to adjust execution policies to run the script successfully. For more comprehensive instructions, including specific .exe downloads, consult the MicroENV Windows installation page.
Verification
After installation, verify that the CLI is correctly installed and accessible by running:
microenv --version
This command should output the installed version of the MicroENV CLI, confirming successful setup.
Quickstart example
This quickstart demonstrates how to use the MicroENV CLI to retrieve environment variables for a specific project and environment. This example assumes you have already authenticated the CLI using microenv login and have a project set up in the MicroENV Cloud Dashboard with some variables defined.
1. Log in to MicroENV
First, authenticate your CLI session. This will open a browser window for you to log in to your MicroENV account:
microenv login
2. List your projects
To see available projects and their IDs, use the projects command:
microenv projects list
This will output a list of your projects, similar to:
ID NAME
------------------------------------------------
proj_abc123def456 MyWebApp
proj_xyz789uvw012 BackendService
Note down the ID of the project you wish to work with (e.g., proj_abc123def456).
3. Fetch environment variables
You can fetch environment variables for a specific project and environment (e.g., development) using the env command. The --format flag allows you to specify the output format, such as dotenv for direct integration into applications.
microenv env pull --project proj_abc123def456 --environment development --format dotenv > .env
This command fetches all variables associated with the MyWebApp project in the development environment and saves them into a .env file. The .env file will contain key-value pairs like:
DATABASE_URL="postgres://user:pass@host:port/db"
API_KEY="your_api_key_here"
You can then load these variables into your application using a library like dotenv in Node.js or Python, or directly access them in shell scripts. For example, in a Node.js application, after installing dotenv:
require('dotenv').config({ path: '.env' });
console.log(process.env.DATABASE_URL);
4. Run a command with injected variables
MicroENV can also inject environment variables directly into a command without creating a .env file:
microenv run --project proj_abc123def456 --environment production -- npm start
This command executes npm start with all production environment variables for MyWebApp securely injected into the process's environment. This method is particularly useful for CI/CD pipelines, where sensitive variables need to be available to build or deployment scripts without persisting them to disk. AWS Systems Manager Parameter Store documentation provides similar concepts for managing configuration dynamically in cloud environments, highlighting the importance of such injection methods.
Community libraries
As MicroENV's primary interface is its CLI, the ecosystem of community-developed libraries is primarily focused on integrations and wrappers around the CLI's functionality rather than standalone language-specific SDKs. Developers often create custom scripts or small utilities to automate specific workflows with the MicroENV CLI in their preferred language or framework.
While MicroENV itself does not officially endorse or maintain a public registry of community libraries, developers can often find examples and contributions on platforms like GitHub. These contributions typically involve:
- CI/CD pipeline integrations: Scripts for popular CI/CD platforms (e.g., GitHub Actions, GitLab CI, Jenkins) that call the MicroENV CLI to fetch and inject secrets during build or deployment stages.
- Local development helpers: Shell scripts or simple programs that streamline fetching environment variables for different local development contexts.
- Configuration management tool integrations: Modules or plugins for tools like Ansible or Terraform that interact with MicroENV to manage secrets as part of infrastructure-as-code deployments.
Developers looking for community contributions are encouraged to search GitHub or other code repositories for microenv-cli-integration or similar terms. For specific use cases, consulting the MicroENV integrations documentation can provide guidance on how to build custom solutions that leverage the CLI effectively.