### GET /ready Response Body Example (Ready) Source: https://docs.configu.com/interfaces/proxy/ref Responds with a 200 OK status code when the server is ready to accept requests. ```json { "status": "ready" } ``` -------------------------------- ### GET /live Response Body Example Source: https://docs.configu.com/interfaces/proxy/ref Responds with a 200 OK status code and the server's uptime in seconds. ```json { "uptime": 42 } ``` -------------------------------- ### Install Configu Node.js SDK Source: https://docs.configu.com/interfaces/sdk/integrations/overview Install the Configu Node.js SDK using npm, yarn, or pnpm. ```bash npm install @configu/node yarn add @configu/node pnpm add @configu/node ``` -------------------------------- ### Login to Configu ConfigStore Source: https://docs.configu.com/guides Connects to the Configu ConfigStore, which is a managed platform for storing configuration data. Minimal setup is required to get started. ```bash configu login ``` -------------------------------- ### Verify Configu CLI Installation Source: https://docs.configu.com/interfaces/cli/setup Run the 'configu' command to verify that the CLI has been installed successfully. A successful installation will display the help message and the current version. ```shell configu ``` -------------------------------- ### Install Configu CLI Source: https://docs.configu.com/guides Installs the Configu CLI using a shell script. This is the first step to using Configu. ```bash curl https://files.configu.com/cli/install.sh | sh ``` -------------------------------- ### Declare First ConfigSchema Source: https://docs.configu.com/guides/hello-world Initialize a new Configu project with a 'hello-world' example schema. ```shell configu init --hello-world ``` -------------------------------- ### Install Autocomplete for Configu CLI Source: https://docs.configu.com/interfaces/cli/setup Display instructions for installing command-line autocompletion for the Configu CLI. ```shell configu autocomplete ``` -------------------------------- ### Example ConfigExpression in JSON Source: https://docs.configu.com/introduction/concepts Illustrates the equivalent of the CFGU example using a JSON configuration file. It shows how to define conditional logic for configuration properties. ```json { "keys": { "ENABLE_API": { "test": "validator.isBoolean($.storedValue)", "description": "enables a 3rd party service" }, "API_KEY": { "test": "ENABLE_API === true", "description": "API key for a 3rd party service. Only required if ENABLE_API is true" } } } ``` -------------------------------- ### Start Configu Proxy with Docker Compose Source: https://docs.configu.com/interfaces/proxy/setup Command to start the services defined in a Docker Compose file. ```shell docker-compose up ``` -------------------------------- ### Install Project Dependencies Source: https://docs.configu.com/interfaces/cli Installs the necessary project dependencies using pnpm. This is a required step for setting up the development environment. ```bash pnpm install ``` -------------------------------- ### Install Configu CLI on Windows Source: https://docs.configu.com/guides/react-native Install the Configu CLI using PowerShell for Windows environments. ```powershell irm https://files.configu.com/cli/install.ps1 | iex ``` -------------------------------- ### Example .env file content Source: https://docs.configu.com/guides/hello-world The resulting .env file contains the exported configuration variables. ```.env GREETING=welcome SUBJECT= MESSAGE=welcome, ! ``` -------------------------------- ### Install Configu CLI on Circle CI Source: https://docs.configu.com/interfaces/cli/setup Sets up Configu CLI on Circle CI using a custom orb. This involves defining the orb in the configuration and using its setup command. ```yaml # source: https://github.com/configu/setup-cli-orb version: 2.1 orbs: configu: configu/setup-cli-orb@X.Y.Z jobs: use-configu: docker: - image: cimg/base:stable steps: - configu/setup - configu [COMMAND] workflows: deploy: jobs: - use-configu ``` -------------------------------- ### Install Dependencies Source: https://docs.configu.com/interfaces/cli/overview Installs project dependencies using pnpm. This is a required step for contributing to the CLI. ```bash pnpm install ``` -------------------------------- ### Example .env file content Source: https://docs.configu.com/guides An example of the content generated in the .env file after exporting configurations. This file contains key-value pairs ready for application use. ```dotenv GREETING=welcome SUBJECT= MESSAGE=welcome, ! ``` -------------------------------- ### YAML Configuration File Source: https://docs.configu.com/interfaces/.configu Example of a .configu.yaml file defining stores, backup paths, schemas, and scripts. ```yaml $schema: https://files.configu.com/schema/.configu.json stores: store1: backup: true type: storeType1 configuration: option1: value1 option2: value2 store2: type: storeType2 configuration: option3: value3 option4: value4 backup: /path/to/db.sqlite schemas: schema1: ../path/to/schema1.json schema2: /path/to/schema2.json scripts: script1: 'configu command1 --option1 value1' script2: 'configu command2 --option2 value2 | configu command3' ``` -------------------------------- ### Install Configu CLI on GitHub Actions Source: https://docs.configu.com/interfaces/cli/setup Integrates Configu CLI setup into a GitHub Actions workflow using a dedicated action. This allows Configu CLI commands to be run in subsequent steps. ```yaml # source: https://github.com/configu/setup-cli-action steps: - uses: configu/setup-cli-action@v1 - run: configu [COMMAND] ``` -------------------------------- ### Install Configu CLI on Linux/macOS Source: https://docs.configu.com/interfaces/cli/setup Installs the Configu CLI globally using a curl script. This command downloads and executes an installation script that handles dependency checks, binary downloads, and PATH configuration. ```shell curl https://cli.configu.com/install.sh | sh ``` -------------------------------- ### Install Configu CLI Source: https://docs.configu.com/guides/hello-world Install the Configu CLI using a shell script for Linux and macOS, or a PowerShell script for Windows. ```shell curl https://files.configu.com/cli/install.sh | sh ``` ```shell curl https://files.configu.com/cli/install.sh | sh ``` ```powershell irm https://files.configu.com/cli/install.ps1 | iex ``` -------------------------------- ### Install Configu CLI on Bitbucket Source: https://docs.configu.com/interfaces/cli/setup Sets up Configu CLI for Bitbucket pipelines by running the installation script within a pipeline step. Subsequent commands can then utilize the CLI. ```yaml image: atlassian/default-image:3 pipelines: default: - step: script: - curl https://cli.configu.com/install.sh | sh - configu [COMMAND] ``` -------------------------------- ### Install Configu CLI on Jenkins Source: https://docs.configu.com/interfaces/cli/setup Installs Configu CLI on Jenkins by adding an 'Execute Shell' build step to run the installation script. Configu CLI commands can then be executed in subsequent steps. ```shell # Add "Execute Shell" build step curl https://cli.configu.com/install.sh | sh configu [COMMAND] ``` -------------------------------- ### Install Configu CLI on TeamCity Source: https://docs.configu.com/interfaces/cli/setup Installs Configu CLI on TeamCity by adding a 'Command Line' build step to execute the installation script. This makes the CLI available for subsequent build steps. ```shell # Add "Command Line" build step curl https://cli.configu.com/install.sh | sh configu [COMMAND] ``` -------------------------------- ### Install Configu CLI with Docker Source: https://docs.configu.com/interfaces/cli/setup Runs the Configu CLI as a Docker container. This is useful for isolated execution without global installation. ```shell docker run --rm configu/cli [COMMAND] ``` -------------------------------- ### Install Configu CLI on Linux/macOS Source: https://docs.configu.com/guides/react-native Install the Configu CLI using a shell script for Linux and macOS environments. ```shell curl https://files.configu.com/cli/install.sh | sh ``` -------------------------------- ### GET /live Source: https://docs.configu.com/interfaces/proxy/ref Responds with a `200 OK` status code indicating the uptime of the server in seconds. ```APIDOC ## GET /live ### Description Responds with a `200 OK` status code with the uptime of the server in seconds. ### Method GET ### Endpoint /live ### Response #### Success Response (200) - **uptime** (number) - The uptime of the server in seconds. #### Response Example ```json { "uptime": 42 } ``` ``` -------------------------------- ### Install Configu CLI on Azure DevOps Pipelines Source: https://docs.configu.com/interfaces/cli/setup Installs Configu CLI on Azure DevOps Pipelines using script steps. The first step downloads and executes the installation script, and the second allows running Configu CLI commands. ```yaml steps: - script: | (curl https://cli.configu.com/install.sh || wget -qO- https://cli.configu.com/install.sh) | sudo sh displayName: Install Configu CLI - script: configu [COMMAND] displayName: Use Configu CLI ``` -------------------------------- ### GET /docs Source: https://docs.configu.com/interfaces/proxy/ref Responds with an interactive API documentation page for the Configu Proxy Server. ```APIDOC ## GET /docs ### Description Responds with an interactive API documentation page. ### Method GET ### Endpoint /docs ``` -------------------------------- ### Run Configu Proxy with Docker (Advanced) Source: https://docs.configu.com/interfaces/proxy/setup Starts the Configu Proxy server with custom port, authentication, and TLS enabled. Requires mounting certificate files. ```shell docker run --rm --init \ -v /path/to/.configu:/config/.configu \ -v /path/to/certs:/config/certs \ -e CONFIGU_HTTP_PORT=3000 \ -e CONFIGU_AUTH_ENABLED=true -e CONFIGU_AUTH_PRESHARED_KEYS=token \ -e CONFIGU_HTTP_TLS_ENABLED=true -e CONFIGU_HTTP_TLS_CERT=/config/certs/localhost.pem -e CONFIGU_HTTP_TLS_KEY=/config/certs/localhost-key.pem \ -e CONFIGU_CONFIG=/config/.configu \ -p 3000:3000 \ configu/proxy ``` -------------------------------- ### POST /export Request Body Example Source: https://docs.configu.com/interfaces/proxy/ref Defines the structure for an EvalCommand pipeline to export configurations. Specify the ConfigStore, ConfigSet path, schema, and optional configuration overrides. ```json [ { "store": "", "set": "", "schema": { "keys": { "{{key}}": "" } }, "configs": { "{{key}}": "" } }, { "" } ] ``` -------------------------------- ### Run Configu Proxy with Docker Source: https://docs.configu.com/interfaces/proxy/setup Starts the Configu Proxy server using a Docker container. Mounts the local .configu directory and exposes the default port. ```shell docker run --rm --init \ -v /path/to/.configu:/config/.configu \ -e CONFIGU_CONFIG=/config/.configu \ -p 8080:8080 \ configu/proxy ``` -------------------------------- ### Python App Configuration Source: https://docs.configu.com/guides/hashicorp-vault Example of Python code consuming environment variables for PostgreSQL connection details. ```python os.environ['DB_URL'] = 'psql://{user}:{password}@{host}:{port}/{name}'.format( user=os.environ['DB_USER'], password=os.environ['DB_PASSWORD'], host=os.environ['DB_HOST'], port=os.environ['DB_PORT'], name=os.environ['DB_NAME'] ) ``` -------------------------------- ### GET /ready Source: https://docs.configu.com/interfaces/proxy/ref Responds with a `200 OK` status code if the server is ready to accept requests, or a `503 Service Unavailable` status code if it is not. ```APIDOC ## GET /ready ### Description Responds with a `200 OK` status code if the server is ready to accept requests, or a `503 Service Unavailable` status code with an empty response if the server is not ready (e.g., starting up, shutting down). ### Method GET ### Endpoint /ready ### Response #### Success Response (200) - **status** (string) - Indicates the server is ready. #### Response Example ```json { "status": "ready" } ``` #### Error Response (503) An empty response body. ``` -------------------------------- ### Setting Environment Variable on Windows Source: https://docs.configu.com/interfaces/.configu Example of how to set an environment variable before running the 'configu eval' command on Windows. ```bash set PASSWORD=password && configu eval --store store1 --set --schema [-c ] ``` -------------------------------- ### POST /export Response Body Example Source: https://docs.configu.com/interfaces/proxy/ref The expected key-value object format for the exported configuration, where values are coerced to their expected types. ```json { "key": "value" } ``` -------------------------------- ### Default ConfigStore Definition Source: https://docs.configu.com/guides/v1-migration Example of designating a ConfigStore as the default within a .configu file by setting the 'default' property to true. ```yaml stores: json-store: type: json-file configuration: path: path/to/file1.json default-json-store: type: json-file default: true configuration: path: path/to/file2.json ``` -------------------------------- ### Original .cfgu file structure (YAML) Source: https://docs.configu.com/guides/v1-migration This is the original structure of an example .cfgu file in YAML format. ```yaml $schema: https://files.configu.com/schema/.cfgu.json NODE_ENV: description: Defines the environment in which the application runs type: String options: - development - production - test default: development LOG_LEVEL: description: Defines the level of logs to be recorded type: String options: - error - warn - info - verbose - debug - silly default: info SERVICE_ENDPOINT: description: Defines the endpoint for the service type: URL required: true AWS_REGION: description: Defines the AWS region for the service type: AWSRegion default: us-east-1 ``` -------------------------------- ### ConfigExpression Validation Example in YAML Source: https://docs.configu.com/interfaces/.cfgu Demonstrates how to define validation rules for configuration keys using ConfigExpressions in YAML format. Includes environment-specific checks and boolean validation. ```yaml $schema: https://files.configu.com/schema/.cfgu.json keys: NODE_ENV: description: Defines the environment in which the application runs test: expect($.value).to.be.a('string') enum: - development - production - test default: production ENABLE_FEATURE: description: Enables a feature flag. Needs be enabled in production test: - validator.isBoolean($.storedValue) - '$.configs.NODE_ENV.value === "production" ? expect($.value).to.be.true : true' default: false ENABLE_DEBUG_MODE: description: Enables a debug mode. Must not be enabled in production test: - validator.isBoolean($.storedValue) - '$.configs.NODE_ENV.value === "production" ? expect($.value).to.be.false : true' default: false ``` -------------------------------- ### ConfigExpression Validation Example in JSON Source: https://docs.configu.com/interfaces/.cfgu Illustrates the equivalent configuration validation rules as shown in YAML, but presented in JSON format. This includes environment checks and feature flag logic. ```json { "$schema": "https://files.configu.com/schema/.cfgu.json", "keys": { "NODE_ENV": { "description": "Defines the environment in which the application runs", "test": "expect($.value).to.be.a('string')", "enum": ["development", "production", "test"], "default": "production" }, "ENABLE_FEATURE": { "description": "Enables a feature flag. Needs to be enabled in production", "test": [ "validator.isBoolean($.storedValue)", "$.configs.NODE_ENV.value === \"production\" ? expect($.value).to.be.true : true" ], "default": false }, "ENABLE_DEBUG_MODE": { "description": "Enables a debug mode. Must not be enabled in production", "test": [ "validator.isBoolean($.storedValue)", "$.configs.NODE_ENV.value === \"production\" ? expect($.value).to.be.false : true" ], "default": false } } } ``` -------------------------------- ### Original .cfgu file structure (JSON) Source: https://docs.configu.com/guides/v1-migration This is the original structure of an example .cfgu file in JSON format. ```json { "$schema": "https://files.configu.com/schema/.cfgu.json", "NODE_ENV": { "description": "Defines the environment in which the application runs", "type": "String", "options": ["development", "production", "test"], "default": "development" }, "LOG_LEVEL": { "description": "Defines the level of logs to be recorded", "type": "String", "options": ["error", "warn", "info", "verbose", "debug", "silly"], "default": "info" }, "SERVICE_ENDPOINT": { "description": "Defines the endpoint for the service", "type": "URL", "required": true }, "AWS_REGION": { "description": "Defines the AWS region for the service", "type": "AWSRegion", "default": "us-east-1" } } ``` -------------------------------- ### Setting Environment Variable on Linux/MacOS Source: https://docs.configu.com/interfaces/.configu Example of how to set an environment variable before running the 'configu eval' command on Linux or MacOS. ```bash PASSWORD=password configu eval --store store1 --set --schema [-c ] ``` -------------------------------- ### Migrated .cfgu file structure (JSON) Source: https://docs.configu.com/guides/v1-migration This is the migrated structure of the example .cfgu file in JSON format, with declarations moved under the 'keys' property. ```json { "$schema": "https://files.configu.com/schema/.cfgu.json", "keys": { "NODE_ENV": { "description": "Defines the environment in which the application runs", "test": "expect($.value).to.be.a('string')", "enum": ["development", "production", "test"], "default": "development" }, "LOG_LEVEL": { "description": "Defines the level of logs to be recorded", "test": "expect($.value).to.be.a('string')", "enum": ["error", "warn", "info", "verbose", "debug", "silly"], "default": "info" }, "SERVICE_ENDPOINT": { "description": "Defines the endpoint for the service", "test": "validator.isURL($.value)", "required": true }, "AWS_REGION": { "description": "Defines the AWS region for the service", "enum": [ "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "cn-north-1", "cn-northwest-1", "eu-central-1", "eu-north-1", "eu-south-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-1", "us-east-2", "us-gov-east-1", "us-gov-west-1", "us-west-1", "us-west-2" ], "default": "us-east-1" } } } ``` -------------------------------- ### Migrated .cfgu file structure (YAML) Source: https://docs.configu.com/guides/v1-migration This is the migrated structure of the example .cfgu file in YAML format, with declarations moved under the 'keys' property. ```yaml $schema: https://files.configu.com/schema/.cfgu.json keys: NODE_ENV: description: Defines the environment in which the application runs test: expect($.value).to.be.a('string') enum: - development - production - test default: development LOG_LEVEL: description: Defines the level of logs to be recorded test: expect($.value).to.be.a('string') enum: - error - warn - info - verbose - debug - silly default: info SERVICE_ENDPOINT: description: Defines the endpoint for the service test: validator.isURL($.value) required: true AWS_REGION: description: Defines the AWS region for the service enum: - af-south-1 - ap-east-1 - ap-northeast-1 - ap-northeast-2 - ap-northeast-3 - ap-south-1 - ap-southeast-1 - ap-southeast-2 - ca-central-1 - cn-north-1 - cn-northwest-1 - eu-central-1 - eu-north-1 - eu-south-1 - eu-west-1 - eu-west-2 - eu-west-3 - me-south-1 - sa-east-1 - us-east-1 - us-east-2 - us-gov-east-1 - us-gov-west-1 - us-west-1 - us-west-2 default: us-east-1 ``` -------------------------------- ### Development .env File Content Source: https://docs.configu.com/guides/react-native Example content of the .env file generated for the development environment. This file contains API URLs, keys, and feature flags. ```.env EXPO_PUBLIC_API_URL=https://dev.api.example.com EXPO_PUBLIC_API_KEY=abc123 EXPO_PUBLIC_POST_BUTTON_ENABLED=true EXPO_PUBLIC_POST_BUTTON_COLOR=red ``` -------------------------------- ### ConfigExpressions Example: CLI Export Template File Source: https://docs.configu.com/guides/v1-migration Illustrates using ConfigExpressions within a .env file template for the 'configu export' command, showing string interpolation and function calls. ```.env SUBJECT={{SUBJECT}} GREETING={{toUpper(GREETING)}} ``` -------------------------------- ### Generate Self-Signed Certificate with mkcert Source: https://docs.configu.com/interfaces/proxy/setup Use mkcert to generate a self-signed certificate and private key for development. This tool simplifies the process and handles local CA installation. ```shell mkcert --install mkcert -key-file server.key -cert-file server.crt localhost ``` -------------------------------- ### Initialize Configu with Hello World Source: https://docs.configu.com/guides Initializes a new Configu project with a 'hello-world' template. This sets up the basic structure for your configuration. ```bash configu init --hello-world ``` -------------------------------- ### Production .env File Content Source: https://docs.configu.com/guides/react-native Example content of the .env file generated for the production environment. This file contains production API URLs and feature flags. ```.env EXPO_PUBLIC_API_URL=https://api.example.com EXPO_PUBLIC_API_KEY=prod123 EXPO_PUBLIC_POST_BUTTON_ENABLED=false EXPO_PUBLIC_POST_BUTTON_COLOR=green ``` -------------------------------- ### ConfigSchema Definition in YAML Source: https://docs.configu.com/introduction/concepts An example of a ConfigSchema file in YAML format, defining an 'API_KEY' configuration as a required string with a description. This schema helps validate and structure configuration data. ```yaml keys: API_KEY: test: validator.isString($.value) required: true description: 'API key for a 3rd party service' ``` -------------------------------- ### Basic Usage with Import/Require Source: https://docs.configu.com/interfaces/sdk/integrations/overview Demonstrates basic SDK usage with imports, including setting up a config store, config set, and schema, then performing upsert, eval, and export operations. ```javascript import { JsonFileConfigStore, ConfigSet, ConfigSchema, UpsertCommand, EvalCommand, ExportCommand } from '@configu/node'; import schemaContents from './start.cfgu.json'; (async () => { try { const store = new JsonFileConfigStore({ path: 'config-db.json' }); const set = new ConfigSet('test'); const schema = new ConfigSchema('start', schemaContents); await new UpsertCommand({ store, set, schema, configs: { GREETING: 'hey', SUBJECT: 'configu node.js sdk', }, }).run(); const data = await new EvalCommand({ store, set, schema, }).run(); const configurationData = await new ExportCommand({ pipe: data, }).run(); } catch (error) { console.error(error); } })(); ``` -------------------------------- ### Grant Permissions for Configu Access Source: https://docs.configu.com/integrations/store/secret/kubernetes-secret Grant necessary permissions to the Configu service account by creating a role binding. This example grants `admin` role to the `default` service account in the `default` namespace. ```bash kubectl create rolebinding configu-access --clusterrole=admin --serviceaccount=default:default ``` -------------------------------- ### Install Configu CLI on GitLab CI/CD Source: https://docs.configu.com/interfaces/cli/setup Sets up Configu CLI for GitLab CI/CD pipelines by including a remote YAML file. This defines a job that extends a base Configu CLI setup. ```yaml # source: https://gitlab.com/configu1/setup-cli-gitlab-ci include: - remote: 'https://gitlab.com/configu1/setup-cli-gitlab-ci/-/raw/main/configu.gitlab-ci.yml' use-configu-job: stage: deploy extends: .configu/setup-cli script: - configu [COMMAND] ``` -------------------------------- ### Configu CLI Synopsis Source: https://docs.configu.com/interfaces/cli Displays the general syntax for using the Configu CLI, including commands and optional flags. Use '--help' for specific command details. ```bash configu [--string-flag ] [--boolean-flag] ``` -------------------------------- ### Development Environment Variables Source: https://docs.configu.com/guides/hashicorp-vault A sample .env file for local development, defining PostgreSQL connection parameters. ```bash DB_USER=user DB_PASSWORD=123 DB_HOST=127.0.0.1 DB_PORT=5433 DB_NAME=database ``` -------------------------------- ### Evaluate Schema and Export to .env File Source: https://docs.configu.com/guides/hashicorp-vault Evaluate the Configu schema with defaults and export the configuration into a .env file. ```bash configu eval --schema "./my-app.cfgu.json" --defaults | configu export --format "Dotenv" > .env.development ``` -------------------------------- ### Connect to Configu ConfigStore Source: https://docs.configu.com/guides/hello-world Log in to your Configu ConfigStore to manage your configuration data. ```shell configu login ``` -------------------------------- ### Evaluate Schema and Run App Locally Source: https://docs.configu.com/guides/hashicorp-vault Evaluate the Configu schema with defaults and pipe the output to run the application locally. ```bash configu eval --schema "./my-app.cfgu.json" --defaults | configu export --run "py my-app.py" ``` -------------------------------- ### Configu CLI Synopsis Source: https://docs.configu.com/interfaces/cli/overview Basic structure for using Configu CLI commands. Use `--help` for specific command details. ```shell configu [--string-flag ] [--boolean-flag] ``` -------------------------------- ### JSON Configuration File Source: https://docs.configu.com/interfaces/.configu Equivalent configuration using the .configu.json format. ```json { "$schema": "https://files.configu.com/schema/.configu.json", "stores": { "store1": { "backup": true, "type": "storeType1", "configuration": { "option1": "value1", "option2": "value2" } }, "store2": { "type": "storeType2", "configuration": { "option3": "value3", "option4": "value4" } } }, "backup": "/path/to/db.sqlite", "schemas": { "schema1": "../path/to/schema1.json", "schema2": "/path/to/schema2.json" }, "scripts": { "script1": "configu command1 --option1 value1", "script2": "configu command2 --option2 value2 | configu command3" } } ``` -------------------------------- ### Generate Self-Signed Certificate with OpenSSL Source: https://docs.configu.com/interfaces/proxy/setup Use OpenSSL to generate a self-signed certificate and private key for development purposes. Ensure you have OpenSSL installed. ```shell openssl req -x509 -newkey rsa:4096 -nodes -sha256 -subj '/CN=localhost' -keyout server.key -out server.crt ``` -------------------------------- ### Evaluate Schema and Export to Shell Source: https://docs.configu.com/guides/hashicorp-vault Evaluate the Configu schema with defaults and export the configuration variables into the current shell session. ```bash configu eval --schema "./my-app.cfgu.json" --defaults | configu export --source ``` -------------------------------- ### New Cfgu Property: Conditional Validation Source: https://docs.configu.com/guides/v1-migration Shows an example of using the 'test' property to implement conditional validation, replacing the 'depends' property. ```yaml keys: ENABLE_FEATURE: test: validator.isBoolean($.storedValue) MY_KEY: test: - "$.configs.ENABLE_FEATURE.value ? expect($.value).to.be.a('string') : true" ``` -------------------------------- ### Initialize Configu Schema from .env File Source: https://docs.configu.com/guides/react-native Create a Configu schema declaration (`expo.cfgu.json`) by importing an existing `.env` file and setting its values as defaults. ```shell configu init --import .env --defaults --name expo ``` -------------------------------- ### Usage with fs & path for Schema Loading Source: https://docs.configu.com/interfaces/sdk/integrations/overview Shows how to use the SDK with Node.js's built-in 'fs' and 'path' modules to load schema contents from a file asynchronously. ```javascript import path from 'path'; import fs from 'fs/promises'; import { JsonFileConfigStore, ConfigSet, ConfigSchema, UpsertCommand, EvalCommand, ExportCommand, } from '@configu/node'; (async () => { try { const store = new JsonFileConfigStore({ path: 'config-db.json' }); const set = new ConfigSet('test'); const schemaContentsString = await fs.readFile(path.join(__dirname, 'start.cfgu.json')); const schemaContents = JSON.parse(schemaContentsString); const schema = new ConfigSchema('start', schemaContents); ... } catch (error) { console.error(error); } })(); ``` -------------------------------- ### List Kubernetes Namespaces Source: https://docs.configu.com/integrations/store/secret/kubernetes-secret Check if the specified namespace exists in your Kubernetes cluster by listing all available namespaces using `kubectl get namespaces`. ```bash kubectl get namespaces ``` -------------------------------- ### Example ConfigExpression in CFGU Source: https://docs.configu.com/introduction/concepts Demonstrates using ConfigExpressions for conditional logic in a CFGU file. The 'test' property uses validator.js and checks against the stored value. ```yaml keys: ENABLE_API: test: validator.isBoolean($.storedValue) description: 'enables a 3rd party service' API_KEY: test: 'ENABLE_API === true' description: 'API key for a 3rd party service. Only required if ENABLE_API is true' ``` -------------------------------- ### ConfigExpressions Example: Test Cfgu Property Source: https://docs.configu.com/guides/v1-migration Demonstrates using ConfigExpressions with the 'test' property on a Cfgu to validate a string value using Chai assertions. ```yaml keys: MY_STRING: test: expect($.value).to.be.a('string') ``` -------------------------------- ### Evaluate Configs with a Specific Tag using Node.js SDK Source: https://docs.configu.com/integrations/store/configu/config-history Use the ConfiguConfigStore with the 'tag' parameter to evaluate configurations against a specific snapshot. This ensures deterministic evaluations. Ensure you have the necessary credentials and permissions. ```javascript import { ConfiguConfigStore, ConfigSet, ConfigSchema, EvalCommand, ExportCommand } from '@configu/node'; import schemaContents from './start.cfgu.json'; (async () => { try { const store = new ConfiguConfigStore({ credentials: { org: process.env.CONFIGU_ORG, token: process.env.CONFIGU_TOKEN, }, tag: 'v1.0.0', }); const set = new ConfigSet('test'); const schema = new ConfigSchema('start', schemaContents); const data = await new EvalCommand({ store, set, schema, }).run(); const configurationData = await new ExportCommand({ pipe: data, }).run(); } catch (error) { console.error(error); } })(); ``` -------------------------------- ### Run Configu CLI from Bin Directory Source: https://docs.configu.com/interfaces/cli/setup Execute the Configu CLI directly from its 'bin' directory after extraction. ```shell ./configu/bin/configu [COMMAND] ``` -------------------------------- ### Test Kubernetes Cluster Access Source: https://docs.configu.com/integrations/store/secret/kubernetes-secret Verify connectivity to your Kubernetes cluster using `kubectl get nodes`. This is a preliminary step for diagnosing cluster access issues. ```bash kubectl get nodes ``` -------------------------------- ### Accessing Environment Variables as ConfigKey Source: https://docs.configu.com/introduction/concepts Demonstrates how to access a configuration value named 'CONFIG' as an environment variable across various programming languages. Ensure the environment variable is set before running. ```javascript process.env.CONFIG; ``` ```python os.environ['CONFIG'] ``` ```c++ std::getenv("CONFIG") ``` ```go os.Getenv("CONFIG") ``` ```rust env::var("CONFIG") ``` ```csharp Environment.GetEnvironmentVariable("CONFIG") ``` ```java System.getenv("CONFIG") ``` ```ruby ENV['CONFIG'] ``` ```scala sys.env.get("CONFIG").value ``` ```bash $CONFIG ``` ```powershell $env:CONFIG ``` -------------------------------- ### ConfigExpressions Example: CLI Export Filter Flag Source: https://docs.configu.com/guides/v1-migration Shows how to use ConfigExpressions with the 'filter' flag in the 'configu export' command to select configurations based on origin and labels. ```bash configu eval --store my-store --set "" --schema ./tmp/schemas2/start.cfgu.yaml | configu export --filter '$.origin === "empty"' --filter '$.labels.includes("my-label") === true' ``` -------------------------------- ### ConfigSchema Definition in JSON Source: https://docs.configu.com/introduction/concepts An example of a ConfigSchema file in JSON format, defining an 'API_KEY' configuration as a required string with a description. This schema helps validate and structure configuration data. ```json { "keys": { "API_KEY": { "test": "validator.isString($.value)", "required": true, "description": "API key for a 3rd party service" } } } ``` -------------------------------- ### Configuration File Extensions Source: https://docs.configu.com/introduction/concepts Common file extensions used for configuration files in Configu. ```text .cfgu.yaml|yml|json ``` -------------------------------- ### Set SQLite Busy Timeout Source: https://docs.configu.com/integrations/store/db/sqlite To resolve 'Database is locked' errors, set the `PRAGMA busy_timeout` to make SQLite wait before throwing an error. This example sets the timeout to 3000 milliseconds. ```sql PRAGMA busy_timeout = 3000; ``` -------------------------------- ### Authenticate with GCP using CLI Source: https://docs.configu.com/integrations/store/secret/gcp-secret-manager If not using a key file, authenticate your environment with GCP using 'gcloud auth application-default login'. This ensures Configu can access your secrets. ```bash gcloud auth application-default login ``` -------------------------------- ### MySQL Store Declaration Source: https://docs.configu.com/integrations/store/db/mysql Declare a MySQL store in your .configu configuration file. Ensure the host, username, password, and database are correctly specified. ```yaml stores: my-store: type: my-sql configuration: host: localhost username: test password: test database: test ``` -------------------------------- ### List Secrets in a Namespace Source: https://docs.configu.com/integrations/store/secret/kubernetes-secret Retrieve a list of secrets within a specific namespace using `kubectl get secrets -n `. This helps in verifying secret existence and access permissions. ```bash kubectl get secrets -n ``` -------------------------------- ### YAML with Environment Variable Source: https://docs.configu.com/interfaces/.configu Demonstrates using an environment variable within a YAML configuration for sensitive data like passwords. ```yaml $schema: https://files.configu.com/schema/.configu.json stores: store1: type: 'storeType1' configuration: option1: 'value1' password: '{{PASSWORD}}' ``` -------------------------------- ### Create ConfigMap for Configu Proxy Configuration Source: https://docs.configu.com/interfaces/proxy/setup Creates a Kubernetes ConfigMap from a local .configu file to be used by the Configu Proxy deployment. ```shell kubectl create configmap configu-config --from-file=/path/to/.configu ``` -------------------------------- ### Evaluate Schema Locally Source: https://docs.configu.com/ Fetch default configuration values directly from a .cfgu schema file without an internet connection. Ensure the schema file is present in the specified path. ```bash configu eval --schema 'my-schema.cfgu.yaml' ```