-
Notifications
You must be signed in to change notification settings - Fork 123
feat: Expose envconfig functionality through C bridge #986
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
Changes from 7 commits
07bb436
60895cb
dd2345b
b1ea496
c4212d7
614c72e
91e73c5
c04cd5c
bceec7a
b550109
024df91
543a067
204342a
de26121
ac570c2
7c8efb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,6 +240,53 @@ typedef void (*TemporalCoreClientRpcCallCallback)(void *user_data, | |
| const struct TemporalCoreByteArray *failure_message, | ||
| const struct TemporalCoreByteArray *failure_details); | ||
|
|
||
| /** | ||
| * OrFail result for client config loading operations. | ||
| * Either success or fail will be null, but never both. | ||
| * If success is not null, it contains JSON-serialized client configuration data. | ||
| * If fail is not null, it contains UTF-8 encoded error message. | ||
| * The returned ByteArrays must be freed by the caller. | ||
| */ | ||
| typedef struct TemporalCoreClientConfigOrFail { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry to be pedantic here and sorry I didn't read close enough earlier, but this is not clear it's env config, it makes it seem like it's generic config. Can we change the 4 struct names here to have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not at all - renamed all structs to have |
||
| const struct TemporalCoreByteArray *success; | ||
| const struct TemporalCoreByteArray *fail; | ||
| } TemporalCoreClientConfigOrFail; | ||
|
|
||
| /** | ||
| * Options for loading client configuration. | ||
| */ | ||
| typedef struct TemporalCoreClientConfigLoadOptions { | ||
| const char *path; | ||
| struct TemporalCoreByteArrayRef data; | ||
| bool config_file_strict; | ||
| struct TemporalCoreByteArrayRef env_vars; | ||
| } TemporalCoreClientConfigLoadOptions; | ||
|
|
||
| /** | ||
| * OrFail result for client config profile loading operations. | ||
| * Either success or fail will be null, but never both. | ||
| * If success is not null, it contains JSON-serialized client configuration profile data. | ||
| * If fail is not null, it contains UTF-8 encoded error message. | ||
| * The returned ByteArrays must be freed by the caller. | ||
| */ | ||
| typedef struct TemporalCoreClientConfigProfileOrFail { | ||
| const struct TemporalCoreByteArray *success; | ||
| const struct TemporalCoreByteArray *fail; | ||
| } TemporalCoreClientConfigProfileOrFail; | ||
|
|
||
| /** | ||
| * Options for loading a specific client configuration profile. | ||
| */ | ||
| typedef struct TemporalCoreClientConfigProfileLoadOptions { | ||
| const char *profile; | ||
| const char *path; | ||
|
THardy98 marked this conversation as resolved.
Outdated
|
||
| struct TemporalCoreByteArrayRef data; | ||
| bool disable_file; | ||
| bool disable_env; | ||
| bool config_file_strict; | ||
| struct TemporalCoreByteArrayRef env_vars; | ||
| } TemporalCoreClientConfigProfileLoadOptions; | ||
|
|
||
| typedef union TemporalCoreMetricAttributeValue { | ||
| struct TemporalCoreByteArrayRef string_value; | ||
| int64_t int_value; | ||
|
|
@@ -771,6 +818,20 @@ void temporal_core_client_rpc_call(struct TemporalCoreClient *client, | |
| void *user_data, | ||
| TemporalCoreClientRpcCallCallback callback); | ||
|
|
||
| /** | ||
| * Load all client profiles from given sources. | ||
| * Returns ClientConfigOrFail with either success JSON or error message. | ||
| * The returned ByteArrays must be freed by the caller. | ||
| */ | ||
| struct TemporalCoreClientConfigOrFail temporal_core_client_config_load(const struct TemporalCoreClientConfigLoadOptions *options); | ||
|
|
||
| /** | ||
| * Load a single client profile from given sources with env overrides. | ||
| * Returns ClientConfigProfileOrFail with either success JSON or error message. | ||
| * The returned ByteArrays must be freed by the caller. | ||
| */ | ||
| struct TemporalCoreClientConfigProfileOrFail temporal_core_client_config_profile_load(const struct TemporalCoreClientConfigProfileLoadOptions *options); | ||
|
|
||
| struct TemporalCoreMetricMeter *temporal_core_metric_meter_new(struct TemporalCoreRuntime *runtime); | ||
|
|
||
| void temporal_core_metric_meter_free(struct TemporalCoreMetricMeter *meter); | ||
|
|
||
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.
Yeah we should not do that. I assume you ran into this and it caused a problem somehow? I missed this one when it first when in.
The move here is to spawn off this test into a new process, and you can set the env vars for just that process. The test can early-return unless some special env var is set that lets it know it's been spawned off.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hmm the change I made to this test is working locally, but I guess CI may have more restrictions around setting env variables, given that the thread panicked:
the alternative I can think of is to revert the test change and just run it serially
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.
Didn't realize we run
ignoredtests in CI, this is panicking because env vars aren't set. Added conditional to skip if env vars aren't set