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

Fix TS definition for appSessionSecret #52

Merged
merged 1 commit into from
Jan 17, 2020
Merged

Fix TS definition for appSessionSecret #52

merged 1 commit into from
Jan 17, 2020

Conversation

joshcanhelp
Copy link
Contributor

Description

Fix TS definition for appSessionSecret config key, should be optional as it can be defined in an env var.

References

Related to #46

@joshcanhelp joshcanhelp added this to the v0.7.0 milestone Jan 16, 2020
@joshcanhelp joshcanhelp requested a review from a team January 16, 2020 22:21
@@ -23,7 +23,7 @@ interface ConfigParams {
* REQUIRED. The secret(s) used to derive an encryption key for the user identity in a session cookie.
* Can use env key APP_SESSION_SECRET instead.
*/
appSessionSecret: boolean | string | string[];
appSessionSecret?: boolean | string | string[];

Choose a reason for hiding this comment

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

Are there any tests needed around this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know but probably not? Are there test you can write for a JS library TS definition file?

Choose a reason for hiding this comment

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

Not so much the definition file but I meant the fact that the property is now optional. What happens when it's not supplied and and environment variable isn't set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then you'll get a validation error on startup.

@@ -23,7 +23,7 @@ interface ConfigParams {
* REQUIRED. The secret(s) used to derive an encryption key for the user identity in a session cookie.
Copy link

@stevehobbsdev stevehobbsdev Jan 17, 2020

Choose a reason for hiding this comment

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

Should this now read OPTIONAL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's still required but you can set the value in your env and not in the config object.

Copy link

@stevehobbsdev stevehobbsdev Jan 17, 2020

Choose a reason for hiding this comment

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

Hmm, feels weird to have an optional property here but then say it's required in the docs. Wouldn't that confuse people?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The application needs a value, that part is a requirement, but you can set it in the config object (which the TS defs affect) or you can set it in an env variable and skip the config key. Either way it is used by the app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevehobbsdev stevehobbsdev self-requested a review January 17, 2020 22:01
@joshcanhelp joshcanhelp merged commit 800ffe0 into auth0:master Jan 17, 2020
@joshcanhelp joshcanhelp deleted the fix-ts-def-app-session-secret branch January 17, 2020 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants