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

Add startup lifecycle hook #1531

Merged
merged 5 commits into from Mar 7, 2024
Merged

Add startup lifecycle hook #1531

merged 5 commits into from Mar 7, 2024

Conversation

inlined
Copy link
Member

@inlined inlined commented Mar 2, 2024

Adds a new function that can be used at global scope to perform initialization in production that won't be called during discovery. In this function, params will be guaranteed to have actual values.

Usage:

const apiKey = params.defineSecret("API_KEY");

onInit(() => {
  someSDK.init(apiKey.value);
});

Copy link
Contributor

@blidd-google blidd-google left a comment

Choose a reason for hiding this comment

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

LGTM

import * as logger from "../logger";

let initCallback: (() => unknown) | null = null;
let didInit = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we leave globals as camel-cased or in CAPS?

Copy link
Member Author

Choose a reason for hiding this comment

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

Typically CAPS is for consts, which these aren't

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.

None yet

2 participants