# CI/CD with Configu Source: https://docs.configu.com/guides/ci-cd Advanced integration strategies for deploying Configu in your CI/CD pipelines, tailored for experienced engineers aiming to optimize deployment workflows. export const Construction = () => This section is under construction and will be ready soon. Thanks for your patience! 🚧 ; # Managing HashiCorp Vault using Configu CLI Source: https://docs.configu.com/guides/hashicorp-vault Today's developer teams are tasked with having to manage Config Ops on the *platform* as well, and HashiCorp Vault is a great opportunity to show how Configu lets you only worry about your config [schemas](/introduction/concepts#configschema), with Configu providing the rest of what's needed, including talking to Vault's API to get and validate your new config values in place. Check out the tutorial below ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/vault-diagram.png) To complete the tutorial, you'll need a HashiCorp Vault Server and Credentials (easiest is having it installed as a [docker](https://github.com/hashicorp/docker-vault)), [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git), [Configu's CLI](/interfaces/cli/setup), and a simple 'hello world' app to deploy which we've provided in this repo. In most cases, your application already has a configuration file, in this example, we will examine Python code that consumes a PostgreSQL connection URL and a `.env` file: ```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'] ) ``` ```bash .env.development DB_USER=user DB_PASSWORD=123 DB_HOST=127.0.0.1 DB_PORT=5433 DB_NAME=database ``` ## Step 1 - Create schema declaration Instead of maintaining a `.env` file for each environment or Vault for production and possibly for other sensitive environments, create a `.cfgu` schema declaration for this service, so that each change will only have to be changed once (only the key in the schema) and then the values will be initialized by the same interface. Our schema will look like this: ```json my-app.cfgu.json { "keys": { "DB_USER": { "test": "expect($.value).to.be.a('string')", "default": "user" }, "DB_PASSWORD": { "test": "expect($.value).to.be.a('string')", "default": "123" }, "DB_HOST": { "test": "validator.isIP($.value, 4)", "required": "true", "default": "127.0.0.1" }, "DB_PORT": { "test": "validator.isPort($.storedValue)", "required": "true", "default": "5433" }, "DB_NAME": { "test": "expect($.value).to.be.a('string')", "default": "database" }, "DB_URL": { "test": "expect($.value).to.be.a('string')", "const": "psql://{{DB_USER}}:{{DB_PASSWORD}}@{{DB_HOST}}:{{DB_PORT}}/{{DB_NAME}}", "description": "Generates a full PostgreSQL URL connection" } } } ``` Although saving configurations in the source control is considered to be bad practice, the Cfgu format is designed to be part of the code as it doesn't include any sensitive values. Doing that increases developers' velocity and helps them avoid leaving the terminal/IDE for other config management platforms. ## Step 2 - Use defaults for local development Running a local environment was never easier, choose your preferred way to inject your environment variables: * Run Configu seamlessly with your app ```bash configu eval --schema "./my-app.cfgu.json" --defaults | configu export --run "py my-app.py" ``` * Inject the variables into your shell ```bash configu eval --schema "./my-app.cfgu.json" --defaults | configu export --source ``` * Download and use `.env` file or any other format you want ```bash configu eval --schema "./my-app.cfgu.json" --defaults | configu export --format "Dotenv" > .env.development ``` ## Step 3 - Manage configs in HashiCorp Vault using Configu Orchestrator Using a single set of commands we can control any store from local files on git to secret managers. In the following example, we will manage our configs over our HashiCorp Vault secret manage. ### Authenticate HashiCorp Vault Configu's CLI uses the standard env vars HashiCorp uses, if you have the Vault CLI configured and working, there's no special action to take. If not please configure your environment with the required variables (See variables [here](https://github.com/hashicorp/vault/blob/api/v1.0.4/api/client.go#L28)). ### Upsert values ```bash configu upsert --store "hashicorp-vault" --schema "./my-app.cfgu.json" --set "prod" \ --kv "DB_USER=user" --kv "DB_PASSWORD=123" --kv "DB_HOST=localhots" \ --kv "DB_PORT=5433" --kv "DB_NAME=database" ``` ### Export values Similar to the way we previously used the Cfgu defaults we can evaluate and export from any store we need. ```bash configu eval --store "hashicorp-vault" --schema "./my-app.cfgu.json" --set "prod" \ | configu export --run "py my-app.py" ``` You're done! This was a simple operation, but that's the best way to show someone the power and the simplicity of Configu Orchestrator and how you can use it to manage your configuration automatically and safely using all your current stores. # Hello World Source: https://docs.configu.com/guides/hello-world Learn how to quickly get started with `Configu`. We'll use the `Configu CLI` and the `Configu ConfigStore` (Configu Platform) to declare, initialize, and export a simple set of configuration data. ### 1. Install Configu CLI ```shell Linux curl https://files.configu.com/cli/install.sh | sh ``` ```shell MacOS curl https://files.configu.com/cli/install.sh | sh ``` ```powershell Windows irm https://files.configu.com/cli/install.ps1 | iex ``` ### 2. Declare your first ConfigSchema ```shell configu init --hello-world ``` ### 3. Connect to Configu ConfigStore ```shell configu login ``` The [Configu `ConfigStore`](https://app.configu.com/) is a convenient way to get started with Configu, especially for users who are new to the tool. It is a configuration management platform that is easy to use and requires minimal setup, with a free starter plan option. To get started with [Configu Platform](https://app.configu.com/), you'll need to [register and create a new organization](https://app.configu.com/). It's important to note that [Configu Platform](https://app.configu.com/) is just one of many options for storing and managing configuration data with Configu. If you have specific requirements or preferences, you may wish to explore other [ConfigStore options](/integrations/overview#configstore), such as using a database, a secret manager, a feature flag system, or your own custom implementation. ### 4. Upsert Configs to ConfigSet ```shell configu upsert \ --store 'configu' --set 'development' --schema './start.cfgu.json' \ --kv "GREETING=hey" --kv "SUBJECT=" \ && configu upsert \ --store 'configu' --set 'development/qa' --schema './start.cfgu.json' \ -kv "GREETING=hola" \ && configu upsert \ --store 'configu' --set 'production' --schema './start.cfgu.json' \ -kv "GREETING=welcome" ``` ### 5. Export the configuration data ```shell configu eval \ --store 'configu' --set 'development/qa' --schema './start.cfgu.json' \ | configu export \ --format "Dotenv" \ > ".env" ``` As a result, you will get a `.env` file with the configurations declared in the "get-started" ConfigSchema and their values from the "test" ConfigSet. ```.env GREETING=welcome SUBJECT= MESSAGE=welcome, ! ``` That's it! You now have a simple set of configuration data stored in the [Configu Cloud](https://app.configu.com/), ready to be used in your application. To learn more about Configu and how to use it, you can continue to explore the documentation and join the Configu [Discord channel](https://discord.com/invite/cjSBxnB9z8), where you can ask questions and get help from the Configu team and other community members. # Integrate Configu Source: https://docs.configu.com/guides/integrate-configu Step-by-step guide for engineers to incorporate Configu into small-scale applications, enhancing configuration management from the get-go. export const Construction = () => This section is under construction and will be ready soon. Thanks for your patience! 🚧 ; # Create a Discord Webhook Source: https://docs.configu.com/guides/platform/discord-webhook Learn how to send Activity Log events to a Discord channel. ## Prerequisites * Access permissions to create a WebHook for your Discord channel. * Configu Cloud organization with admin permissions ## Create a Discord WebHook For this integration to work, you'll need a [Discord Webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks). Browse to that URL and follow the steps. Get your Webhook URL which looks something like this: `https://discord.com/api/webhooks/XXXXXXXXXX/YYYYYYYYYY`. ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/discord-webhook-payload-uri-1.png)
![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/discord-webhook-payload-uri-2.png) ## Create a Configu Webhook 1. Browse to the Webhooks page (/integrations/webhooks) in your Confgu Cloud organization. 2. Create a new webhook using the Slack Payload URL you obtained in the previous step. 3. Customize your payload to include a `context` property with some message, and then click Create. [Explore the Full Webhooks documentation](/integrations/store/configu/webhooks). ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/discord-customize-your-payload.png) Example result: ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/discord-result-of-triggering.png) # Trigger Github Actions using a Configu Webhook Source: https://docs.configu.com/guides/platform/github-actions-webhook Learn how to trigger a [GitHub workflow](https://docs.github.com/en/actions/using-workflows/triggering-a-workflow) from a webhook invocation. ## Prerequisites * Access permissions to create a WebHook for Github Actions. * Configu Cloud organization with admin permissions (if you donn't have an account, get one free [here](https://app.configu.com)) ## Create a Configu Webhook 1. Define your target workflow payload URL: `https://api.github.com/repos/{owner}/{repo}/actions/workflows/{action-id}/dispatches`, example: ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/github-customize-your-payload.png) 2. Customize your header to include an `Authorization` header with your GitHub personal access token. Example: ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/github-authorization-header.png) 3. Customize your payload to contain the data you need, for this example: ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/github-customize-your-payload.png) you will need to send the following payload data: ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/github-customize-your-payload-2.png) * `ref` is the branch that contains the workflow definition * `inputs` is the data that the workflow will use that is sent from the webhook # Create a Slack Webhook Source: https://docs.configu.com/guides/platform/slack-webhook Learn how to send Activity Log events to a Slack channel. ## Prerequisites * Access permissions to create an Incoming WebHook for your Slack workspace. * Configu Cloud organization with admin permissions ## Create a Slack Incoming WebHook For this integration to work, you'll need a Slack [Incoming WebHook](https://api.slack.com/messaging/webhooks). Browse to that URL and follow the steps. Get your target payload URL which looks something like this: `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX`. The standard way is by enabling incoming webhooks on a custom app you installed on your Slack workspace and creating a webhook as such: ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/slack-webhook-payload-uri.png) ## Create a Configu Webhook 1. Browse to the Webhooks page (/integrations/webhooks) in your Confgu Cloud organization. 2. Create a new webhook using the Slack Payload URL you obtained in the previous step. 3. Customize your payload to include a `text` property with some message, and then click Create. [Explore the Full Webhooks documentation](/integrations/store/configu/webhooks). ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/slack-customize-your-payload.png) Example result: ![image](https://mintlify.s3.us-west-1.amazonaws.com/configu/images-old/webhooks/slack-result-of-triggering.png) # React Native with Configu Source: https://docs.configu.com/guides/react-native Learn how to use React Native with `Configu`. We'll use the `Configu CLI` and the `Configu ConfigStore` (Configu Platform) to declare, initialize, and export a simple set of configuration data which you can use in your React Native app. ## 1. The problem When developing a React Native app, you typically need to manage configurations for various environments, like development, testing, and production. You may also need to adjust configurations for different app features or components, which can be time-consuming and error-prone if done manually. Configu helps streamline environment-based configuration in a React Native app, reducing the potential for manual errors. This guide will demonstrate how to use Configu to manage configurations for your React Native app. Let's begin by creating a [simple Expo project](https://docs.expo.dev/get-started/create-a-project/) and introduce environment variables to our React Native app by following the ["Environment variables in Expo"](https://docs.expo.dev/guides/environment-variables/) guide. You should now have the following `.env` file: ```.env EXPO_PUBLIC_API_URL=https://staging.example.com EXPO_PUBLIC_API_KEY=abc123 ``` And the following component that uses it: ```jsx import { Button } from 'react-native'; function Post() { const apiUrl = process.env.EXPO_PUBLIC_API_URL; async function onPress() { await fetch(apiUrl, { ... }) } return