Skip to content

Create Config

In ConfigHub, config data is stored in Units. A Config Unit is a single unit of configuration which can contain multiple resources. Units reside in Spaces. Spaces are used to organize units based on various factors such as environment, application, team ownership, etc.

In this first step of the tutorial we start by creating a space and a unit.

Authenticate

Start by authenticating:

cub auth login

This command will connect to hub.confighub.com and start an authentication flow in your browser. Upon successful authentication, the authentication token and context will be saved in files in ~/.confighub.

Create a Space

First create a Space dedicated to this tutorial:

cub space create tutorial --set-context

This will create a space named "tutorial". --set-context means that it will be set as the default space for subsequent commands. So you don't have to include the --space flag on subsequent commands in this tutorial.

Tip

You can create an automatically named space with cub space create -

Create a Unit

Now let's create a Config Unit containing the configuration for a small AI chat sample app. Create it with the following command:

cub unit create chatapp-dev https://raw.githubusercontent.com/confighub/cubbychat/refs/heads/main/simple/config-data.yaml

This creates the unit in ConfigHub and uploads the config data from the remote location. Note that nothing has been deployed yet. ConfigHub is a storage for config. Deployment is a separate step. You can think of this as adding config to a repository without deploying it yet.

Composition of a Unit

A Config Unit consists of the raw config data along with several record fields which you can consider the metadata. Record fields include data such as name, created time, live status, labels, annotations and more. Config data is the raw config data itself such as a list of Kubernetes YAML manifests.

Config data can theoretically be in any format, but currently only YAML (and more specifically Kubernetes YAML) is well supported. You can see the metadata with:

cub unit get chatapp-dev

which will print something like:

Name                          chatapp-dev                                
Toolchain Type                Kubernetes/YAML                         
Target                        k8s-dev                                 
Created At                    2025-10-28 01:17:15.059317 +0000 UTC    
Updated At                    2025-10-28 18:33:32.209299 +0000 UTC    
Labels                                                                
Delete Gates                                                          
Destroy Gates                                                         
Annotations                                                           
Last Change Description       UpdateUnit                              
Head Revision Num             7                                       
Last Applied Revision Num     1                                       
Live Revision Num             1                                       
Previous Live Revision Num    0                                       
Bridge Worker                 dev                                     
Head Mutation Num             7                                       
Number of Resources           6

You can see the config data with:

cub unit get chatapp-dev --data-only

which will print the exact same yaml document you just used to create this unit.

Summary

  • ConfigHub stores config in Config Units. Uploading config data to ConfigHub does not deploy it. It is just stored in ConfigHub
  • Config data can be manipulated as a data structure. You use functions to make changes to specific fields in the data structure.
  • Config data is versioned. Every change creates a new revision. Old revisions can easily be restored.

Next

Edit Configuration

Further reading