Skip to content

Conversation

THardy98
Copy link
Contributor

What was changed

Environment configuration for Typescript SDK, using core base envconfig module

Why?

Checklist

  1. Closes [Feature Request] Environment Configuration #1727

  2. How was this tested:
    test-envconfig.ts

  3. Any docs updates needed?
    No

@THardy98 THardy98 requested a review from a team as a code owner August 11, 2025 18:33
@THardy98 THardy98 marked this pull request as draft August 23, 2025 06:33
@THardy98 THardy98 marked this pull request as ready for review August 25, 2025 14:45
@THardy98 THardy98 force-pushed the env_config branch 2 times, most recently from b8972f0 to 6033e3a Compare August 25, 2025 16:55
@@ -0,0 +1,525 @@
import * as fs from 'fs';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't have the @temporalio/client package depends on Core. User-side env config stuff will need to go either in the worker package, or we'll make a new package for this (e.g. @temporalio/config).

*/
export type DataSource = { path: string } | { data: string | Buffer };

interface ClientConfigTLSObject {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like that type is meant to be exposed publicly, no? Same for ClientConfigProfileObject and some others.

return fs.readFileSync(source.path);
} catch (error) {
throw new Error(
`Failed to read file at path "${source.path}": ${error instanceof Error ? error.message : String(error)}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Failed to read file at path "${source.path}": ${error instanceof Error ? error.message : String(error)}`
`Failed to read file at path "${source.path}": ${(error as Error).message ?? String(error)}`

return clientConfigProfileFromBridge(bridgeProfile);
}

public toObject(): ClientConfigProfileObject {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need these toObject and fromObject methods?

* const client = new Client({ connection, namespace });
* ```
*/
public toClientConnectConfig(): ClientConnectConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that will work to instantiate a NativeConnection/Worker.

}
}

#[derive(TryIntoJs, Serialize)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Serialize/serde? Seems like this is all being transfered using TryIntoJs.

@THardy98
Copy link
Contributor Author

THardy98 commented Oct 1, 2025

Closing in favor of a pure JS implementation. Notable reasons for this:

  • Clients using envconfig do not need to be tied to a native connection
  • Node-compatible environments may not allow running of native code

@THardy98 THardy98 closed this Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Environment Configuration
2 participants