Summary

Adds server-scoped shared environment variables, allowing users to define variables per server that are automatically available to all applications deployed on that server.

This addresses the limitation described in #7738 where multi-server deployments have no way to distinguish between servers from within the application. Server-level environment variables enable per-server configuration (e.g., server identifiers, region-specific settings) without duplicating variables across individual resources.

Changes

Database

  • New migration adding server_id foreign key to shared_environment_variables table
  • Updated CHECK constraint to include 'server' type
  • Added unique constraint on (key, server_id, team_id)

Models

  • SharedEnvironmentVariable: Added server() relationship
  • Server: Added environment_variables() relationship
  • EnvironmentVariable: Added 'server' type resolution in shared variable lookup — resolves the server through resource → destination → server

Shared Variable Management UI

  • New SharedVariables\Server\Index Livewire component — lists all team servers for selection
  • New SharedVariables\Server\Show Livewire component — full CRUD with normal/developer (bulk edit) views
  • New blade views for server variable listing and management
  • Updated shared variables index page to include “Server wide” navigation link
  • Variables use the {{ server.VARIABLE_NAME }} syntax consistent with existing scopes

Autocomplete Support

  • Updated EnvVarInput component to include 'server' scope in autocomplete dropdown
  • Updated Add.php and Show.php environment variable components to fetch server-scoped variables for autocomplete suggestions

Deployment Integration

  • Runtime: Server environment variables injected after Coolify system variables but before user-defined variables (user vars take precedence)
  • Buildtime: Server environment variables injected at the same priority level (step 2.5 — after COOLIFY_ vars, before SERVICE_ and user vars)
  • New inject_server_environment_variables() method handles runtime injection with proper escaping for literal/multiline values

Routes

  • GET /shared-variables/servers — Server list for variable management
  • GET /shared-variables/server/{server_uuid} — Server variable management page

Constants

  • Updated SHARED_VARIABLE_TYPES to include 'server'

How It Works

  1. Navigate to Shared Variables → Server wide and select a server
  2. Add environment variables scoped to that server
  3. Any application deployed on that server automatically receives those variables at both build and runtime
  4. Variables can also be referenced from other resources using the {{ server.VARIABLE_NAME }} syntax
  5. Application-level variables override server-level variables when names conflict

Security Note

Server IP addresses and other sensitive server metadata are NOT automatically exposed as environment variables, per maintainer guidance in #7738.

/claim #7738

Claim

Total prize pool $111
Total paid $0
Status Pending
Submitted February 27, 2026
Last updated February 27, 2026

Contributors

TE

Tereda_Developer

@teredasites

100%

Sponsors

PR

Praveen Pendyala

@pkpio

$111