-
Notifications
You must be signed in to change notification settings - Fork 53
Expose Environment Configuration #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…n and array support
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @roxblnfk !
Thanks for opening the PR.
Took a quick look through and it looks like the public interface deviates pretty notably from other implementations, see Typescript.
We have typically offered an interface that allows you to:
- load a client configuration (e.g. all profiles in a configuration) from TOML file and overridden by env vars if set
- load a client configuration, but from provided TOML data and overridden by env vars if set
- convert a client configuration back to its TOML representation (as bytes)
- load a single profile
- load a profile and convert it into a representation that can be immediately used by client/connection (for a quick shorthand way to load and configure your client)
I'm requesting changes such that we keep feature parity here and maintain the same interface in the PHP SDK.
I would also keep in mind the control flow, as it differs in the existing implementations as well (i.e. we only throw ProfileNotFound if a profile name was provided by the user, if not, we return an empty profile)
ConfigClient: rename `loadFromFile()` to `loadFromToml()`
|
@THardy98 hi. The specification didn't help me understand some mechanics. Could you clarify these questions: Question 1: What is the expected behavior if:
Will the ENV variable values override the options of the different profile, even though the profile is not the configured TEMPORAL_PROFILE? Question 2: If I load configuration from both ENV variables and a TOML config file, and then save the loaded |
|
Yeah, good questions, I could've clarified this earlier.
Yes, the order of precedence is:
With profile name, if you specify it in code, we will use it. Other env vars should apply on that profile. This TS code snippet should be a good reference (that file generally should be a good reference).
Yes :)
The TOML data will contain the values of whatever configuration you provide it. |
What was changed
See the documentation below
Checklist
Documentation: External Client Configuration Support
Common docs: https://docs.temporal.io/develop/environment-configuration
The PHP SDK now implements the Temporal external client configuration specification, enabling standardized configuration management across development, staging, and production environments.
This feature allows you to:
internal/tomlpackage)Configuration File
Create a
temporal.tomlfile in your platform-specific configuration directory:~/.config/temporalio/temporal.toml(or$XDG_CONFIG_HOME/temporalio/temporal.toml)~/Library/Application Support/temporalio/temporal.toml%APPDATA%\temporalio\temporal.tomlLoading Configuration
The configuration system supports multiple loading strategies:
Environment Variables
All configuration keys can be overridden via environment variables using the
TEMPORAL_*prefix:Environment variables take precedence over configuration file values, enabling easy overrides for CI/CD pipelines and containerized deployments.
Configuration Hierarchy
Configuration is loaded with the following precedence (later values override earlier ones):
TEMPORAL_CONFIG_FILE)TEMPORAL_*variables)Profile Management
Profiles are case-insensitive and support multiple named configurations in a single file:
Loading Strategies
Load from file only:
Load from environment only:
Load with custom EnvProvider (for testing):
Remote Codec Support
Note
Remote codec configuration is not supported in the PHP SDK, following the same approach as TypeScript, Python, and .NET SDKs.
If you attempt to configure a remote codec either in the TOML file or via environment variables, the SDK will throw a
CodecNotSupportedExceptionto prevent silent failures:This explicit error ensures users are aware that codec functionality is not available, rather than silently ignoring the configuration and causing unexpected behavior.
Use Cases
Development to Production:
CI/CD Pipelines:
Multi-Tenant Applications: