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

Feature/registration interval config #50

Merged

Conversation

javibookline
Copy link
Contributor

Allow the user to control the minimum/default outbound registration expire intervals via two new envvars.

Keep the current defaults of 30s and 3600s if the envvars are not defined.

@@ -114,7 +117,7 @@ class Regbot {
else if (res.has('Expires')) {
expires = parseInt(res.get('Expires'));
}
if (isNaN(expires) || expires < 30) expires = DEFAULT_EXPIRES;
if (isNaN(expires) || expires < MIN_EXPIRES) expires = Math.max(MIN_EXPIRES, DEFAULT_EXPIRES);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the scenario where MIN_EXPIRES will possibly be greater than DEFAULT_EXPIRES?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we enable setting DEFAULT_EXPIRES via envvar, well, someone could pass a lower value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's dumb, but I figured if a minimum is set, then we should comply with it

Copy link
Contributor

Choose a reason for hiding this comment

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

why would we allow a default expires value to be less than the minimum? I don't believe in coding to support a case like that, we should rather reject attempts to set meaningless values such as these

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at what level should those attempts be rejected? do we kill the process when loading the envvars? or do we just specify it in the docs and let the code run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jambonz/helm-charts#36 includes these new envvars in the helm charts too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davehorton would you rather leave it as it was?

if (isNaN(expires) || expires < MIN_EXPIRES) expires = DEFAULT_EXPIRES;

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say if expires < MIN_EXPIRES log a message and set it to MIN_EXPIRES

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davehorton is this more in line with what you had in mind?

89832c8

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

@davehorton
Copy link
Contributor

please rebase

@davehorton davehorton merged commit c1f2a5f into jambonz:main Jan 15, 2024
1 check passed
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