Environments
Environments are the central concept in a Flxbl project. An environment links a repository branch to a registered Salesforce org, providing controlled access to credentials for team members and CI/CD pipelines.
Orgs vs Environments
Understanding the distinction between Orgs and Environments is essential:
Org
A registered Salesforce org (production, sandbox, scratch org) with stored credentials
Global - shared across all repositories
Environment
A deployment target that links a repository + branch to a registered org
Repository-specific
┌─────────────────────────────────────────────────────────────────────────────┐
│ Orgs vs Environments │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ REGISTERED ORGS (Global) ENVIRONMENTS (Per Repository) │
│ ──────────────────────── ───────────────────────────── │
│ │
│ [email protected] ─────────► Production (myorg/app-1, main) │
│ └────────► Production (myorg/app-2, main) │
│ │
│ [email protected] ─────────► UAT (myorg/app-1, release/*) │
│ └────────► QA (myorg/app-2, develop) │
│ │
│ [email protected] ─────────► (DevHub for scratch org pools) │
│ │
└─────────────────────────────────────────────────────────────────────────────┘Key differences:
Org Commands (sfp server org)
Environment Commands (sfp server environment)
Register Salesforce credentials
Link orgs to repository branches
Store/update auth details
Control access via locking
JIT sandbox registration
Provide deployment targets
Direct org access via org login
Credential access requires lock or --auth-type
What is an Environment?
An environment represents a deployment target - the combination of:
Repository: Which codebase (e.g.,
myorg/salesforce-app)Branch: Which code branch (e.g.,
main,develop)Salesforce Org: Which org to install artifacts
Category: The environment type (dev, test, release)
Environment Categories
dev
Development
Feature development, local testing
test
Testing
UAT, SIT, QA environments
snapshot
Snapshots
Point-in-time environment copies
release
Production
Production and staging releases
Complete Setup: From Org to Environment
Before creating environments, you need to register your Salesforce orgs with sfp-server. Here's the complete flow:
Step 1: Register Orgs
First, register your Salesforce orgs with sfp-server. See Org Registration for complete details.
Step 2: Create Environments
Link registered orgs to repository branches.
Creating Environments
Basic Creation
With Metadata and Tags
Listing Environments
List All
Output:
Filter by Category
Retrieving Environments
Basic Retrieval (No Credentials)
Get environment information without credentials:
Credential Access Methods
There are two ways to get credentials for an environment:
Method 1: Lock-Based Access (For Deployments)
Recommended for CI/CD and deployments. Locking prevents concurrent deployments from conflicting with each other.
Method 2: Direct Access with --auth-type (No Locking)
--auth-type (No Locking)For testing and read-only operations only. Do not use for deployments - without locking, concurrent operations may conflict.
This retrieves a short-lived access token (~2 hours) and authenticates locally.
When to Use Which Method
CI/CD deployments
Lock-based
Prevents concurrent deployments
Running tests
--auth-type
No locking overhead needed
Quick data queries
--auth-type
Read-only, no conflict risk
Long-running operations
Lock with --wait
Ensures exclusive access
Parallel pipeline jobs
Lock-based
Queue management
Auth Type Selection
accessToken
~2 hours
Short operations, better security
sfdxAuthUrl
Until revoked
Scratch org pools, extended sessions
Environment Properties
Core Properties
name
Unique name within repository
category
dev, test, snapshot, release
branch
Git branch pattern
description
Human-readable description
salesforceUsername
Linked Salesforce org
isActive
Whether environment is active
isDefault
Default for its category
Extended Properties
tags
Searchable tags
metadata
Custom JSON metadata
orchestrationOrder
Deployment sequence
devHubUsername
Parent org (for sandboxes)
Lock Status
When an environment is locked:
Updating Environments
Deleting Environments
Credential Access Control
Role-Based Access
Member
Yes
No
No
Owner
Yes
Yes
Yes
Application
Yes
Yes
Limited
Audit Trail
All credential access is logged:
CI/CD Integration
GitHub Actions
Matrix Deployment
Environment Patterns
Standard Pipeline
Multi-Region
Feature Environments
Related Topics
Server Authentication - Authenticate with sfp-server
Org Registration - Register orgs for environments
Environment Locking - Concurrent access control
Accessing Environments - Practical examples
JIT Sandbox Authentication - On-demand sandbox credentials
Last updated