Skip to content
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

Client and Adapter config #30

Merged
merged 15 commits into from
Feb 26, 2024
Merged

Client and Adapter config #30

merged 15 commits into from
Feb 26, 2024

Conversation

darwin67
Copy link
Contributor

@darwin67 darwin67 commented Feb 25, 2024

Load client configuration and serve configuration following spec and existing SDKs.

@darwin67 darwin67 marked this pull request as ready for review February 26, 2024 01:43
@@ -27,6 +27,10 @@ data class RegistrationRequestPayload(
val v: String,
)

enum class InngestSyncResult {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ignore this for now.
was initially planning to redo the registration but didn't touch it this time.

Copy link
Collaborator

@albertchae albertchae left a comment

Choose a reason for hiding this comment

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

looks good. so it looks like in priority order

  • Inngest client is configured with constructor arguments
  • configure with environment variables
  • use default fallbacks

is that right?

Comment on lines +10 to +11
EventApiBaseUrl("INNGEST_BASE_URL"),
ApiBaseUrl("INNGEST_API_BASE_URL"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI these 2 aren't in the spec, dunno if they should be https://github.com/inngest/inngest/blob/main/docs/SDK_SPEC.md#32-optional-variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can also see it in the docs as well.
https://www.inngest.com/docs/sdk/environment-variables

Copy link
Contributor Author

@darwin67 darwin67 Feb 26, 2024

Choose a reason for hiding this comment

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

I know about INNGEST_API_BASE_URL because I asked it to be added. Otherwise the SDK won't work with our staging environment.

inngest-core/src/main/kotlin/com/inngest/InngestEnv.kt Outdated Show resolved Hide resolved
Comment on lines +21 to +23
Dev("dev"),
Prod("prod"),
Other("other"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

On the inngest dashboard I see there's a concept of branch environments or user created environment names, would Other be able to cover all those?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Branch should be other values.
I don't remember exactly if this should be the case. Could be a question for @jpwilliams

https://github.com/inngest/inngest-js/blob/1b9f101ca6cd310e429cebcf8bceaf2faf309624/packages/inngest/src/helpers/consts.ts#L36

Copy link
Contributor Author

@darwin67 darwin67 Feb 26, 2024

Choose a reason for hiding this comment

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

actually, I think we can skip branch environments for now. that's only for Vercel integration atm, and Vercel users don't use Java.

there might be cases where we have better integration with AWS Lambda or GCP Cloud Function to simulate branch environments but we're not there yet.

inngest-core/src/main/kotlin/com/inngest/Environment.kt Outdated Show resolved Hide resolved
"1" -> InngestEnv.Dev
else -> {
var other = InngestEnv.Other
other.value = sysDev
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if value can be set to anything besides "other" here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

hm I guess it's just an instance variable and nothing is stopping you from having separate enums with the same value or changing the value either. Never thought about that before 🤷

Copy link
Contributor Author

@darwin67 darwin67 Feb 26, 2024

Choose a reason for hiding this comment

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

yup, exactly. probably not the best way to use it, so if we figure better ways in the future, we can swap it out.
The reason I know we want an other is because some users want to run integration tests in CI using our Dev Server but want to not make it in dev mode.

inngest-core/src/main/kotlin/com/inngest/Environment.kt Outdated Show resolved Hide resolved
@darwin67
Copy link
Contributor Author

looks good. so it looks like in priority order

  • Inngest client is configured with constructor arguments
  • configure with environment variables
  • use default fallbacks

is that right?

Correct 👍

@darwin67 darwin67 changed the title Client and Function config Client and Adapter config Feb 26, 2024
@darwin67 darwin67 merged commit 179eb99 into main Feb 26, 2024
7 checks passed
@darwin67 darwin67 deleted the darwin/fn-conf branch February 26, 2024 05:07
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.

2 participants