GuideJuly 15, 20257 min read

Using Profiles to Manage Multiple Development Contexts

Profiles are named contexts that carry their own variables, environment overrides, and path associations. Here's how to use them to manage every development context you work in.

What Profiles Are

A ConfigSync profile is a named set of configuration that activates based on context. Each profile can carry its own variables (used in templates), environment overrides (applied to .env files during pull), and path associations (directories that trigger auto-activation).

Think of profiles as workspaces. A freelance developer might have profiles for personal, client-acme, and client-globex. Each workspace has different git credentials, API keys, and editor settings. Profiles keep these contexts separated without maintaining multiple machines.

Creating Profiles

Create a profile with a name, an optional environment tier, and an optional path association:

Create profiles
# Basic profile configsync profile create personal # Profile with environment tier and path configsync profile create work --env production --path ~/work # Profile copied from an existing one configsync profile create client-acme --copy-from work

The --copy-from flag duplicates all variables and env overrides from an existing profile. This is useful when a new context is similar to an existing one and you only need to change a few values.

Profile Resolution Order

When ConfigSync needs to determine the active profile, it checks these sources in order, using the first match:

PrioritySourceExample
1 (highest)--profile flagconfigsync push --profile work
2CONFIGSYNC_PROFILE env varexport CONFIGSYNC_PROFILE=work
3.configsync-profile fileFile in current or parent directory
4Active profileconfigsync profile switch work
5 (lowest)Path matchingcd ~/work triggers work profile

For most developers, path matching (priority 5) handles daily use. The .configsync-profile file is useful for project-level overrides — drop one into a repo root and anyone on the team who clones it gets the right profile. ConfigSync walks up the directory tree looking for this file, so it works from nested subdirectories too.

Profile Variables

Variables are key-value pairs attached to a profile. They are available in templates as {{vars.VARIABLE_NAME}}:

Set and use variables
# Set variables on a profile configsync profile set-var work EDITOR vim configsync profile set-var work GIT_EMAIL "sean@company.com" configsync profile set-var work THEME dark # Use in a template file # {{vars.EDITOR}} resolves to "vim" when work profile is active

Profile variables override machine variables of the same name. This means you can set a default EDITOR at the machine level and override it per profile when needed.

Environment Overrides

Environment overrides replace values in .env files when pulling. This is how you keep different API keys and database URLs per context:

Set environment overrides
# Work profile gets production database configsync profile set-env-override work DATABASE_URL "postgres://prod-db:5432/app" configsync profile set-env-override work REDIS_URL "redis://prod-cache:6379" # Personal profile gets local services configsync profile set-env-override personal DATABASE_URL "postgres://localhost:5432/dev" configsync profile set-env-override personal REDIS_URL "redis://localhost:6379"

When you run configsync pull, the active profile's overrides are applied to every .env file being restored. The original values remain in the cloud snapshot — overrides are applied at restore time, not at push time.

Important: Environment overrides apply during pull only. When you push, ConfigSync captures the actual file contents. Overrides are a restore-time transformation, so the cloud always has the canonical values.

Switching Profiles

You can explicitly switch the active profile at any time:

Switch profiles
# Set the active profile configsync profile switch work # Check which profile is active configsync profile show # List all profiles configsync profile list

Switching the active profile sets a persistent default (priority 4 in the resolution order). However, if you are in a directory that matches a different profile's path, the path match takes precedence. This means you rarely need to switch manually — just cd into the right directory and the correct profile activates.

Profiles Across Machines

Profiles are part of your ConfigSync state. When you push, your profile definitions, variables, and env overrides are all included. When you pull on a new machine, every profile is restored with its full configuration.

This means setting up a new machine with multiple contexts is a single command. Create your profiles once, push them, and every future machine starts with the same clean separation between work, personal, and client projects.

Ready to try ConfigSync?

Sync your entire dev environment across machines in minutes. Free forever for up to 3 devices.