-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
🪟 🔧 Refactor webapp configuration provider #21456
Conversation
LAUNCHDARKLY_KEY?: string; | ||
analytics: SegmentAnalytics.AnalyticsJS; | ||
} | ||
} | ||
|
||
export interface Config { | ||
export interface AirbyteWebappConfig { |
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.
Renamed to make it more clear what this is a config for
if (!cloudApiUrl) { | ||
throw new MissingConfigError("Missing required configuration cloudApiUrl"); | ||
} |
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.
Another option would be to log the error with our AppMonitoringService()
instead of throwing it here. The downside is that this would not be surfaced to the user in environments without datadog.
airbyte-webapp/src/config/types.ts
Outdated
@@ -38,4 +62,4 @@ export type Provider<T> = () => T; | |||
|
|||
export type ValueProvider<T> = Array<ProviderAsync<DeepPartial<T>>>; | |||
|
|||
export type ConfigProvider<T extends Config = Config> = ProviderAsync<DeepPartial<T>>; | |||
export type ConfigProvider<T extends AirbyteWebappConfig = AirbyteWebappConfig> = ProviderAsync<DeepPartial<T>>; |
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.
I think most of those types could still be removed or the Provider which seems to be used in the auth service, just inlined there instead (and most likely doesn't need a named type).
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.
Thanks, forgot that I wanted to clean up (remove) these unnecessary types!
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.
addressed here 1550b3a
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.
Code LGTM. Have tested locally in cloud mode. Everything seems to be applied as expected.
The e2e tests are legitimately failing here, will need to refactor |
I was too occupied to get in a timely review, but I'm glad I kept the tab open: this is great stuff, much cleaner. |
What
Simplifies our app config to use a single, central configuration object.
Closes #10955
How
Consolidates many config files into one
Previously we had configuration split across many files, organized by where the value was coming from (
.env
file,window
object,config.json
file, etc). These many configuration files have been consolidated into a single object where we can see all config values:src/config/config.ts
.For the moment, we are still setting some configuration properties via the
window
object. This allows us to "inject" runtime overrides in the nginx container. These will be removed in a future PR, in favor of setting all required configuration values via environment variables. This will allow us to configure each environment at build time (without any runtime overrides) and ultimately deploy the application as simple static files on a CDN.Consolidates two
useConfig()
hooks into onePreviously we had two
useConfig()
hooks - one insrc/packages/cloud/services/config
and one insrc/config
. Since the config object has been consolidated, we don't need these two hooks anymore. We will only use the one located insrc/config
.This has some implications: some services depend on configuration values that are only available in cloud environments (such as Firebase or Intercom configuration, a
cloudApiUrl
, etc). These services will now throw aMissingConfigError
if their required config is not available:What's next?
This is Phase 1, Step 1 of the plan outlined here: https://docs.google.com/document/d/1QIDhYP90VSsmL-ddn-2iL5QD-y0fDYgkDd0IErBXYBY/edit#heading=h.wc4fbc3h3qyl
The next step will be Phase 1, Step 2: Removing nginx runtime environment variables
🚨 User Impact 🚨
These changes could potentially break a variety of integrations and functionality, so they should be tested carefully.
Configuration is verified to be working in: