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

Update apiutil.js #178

Merged
merged 1 commit into from
Mar 20, 2025
Merged

Update apiutil.js #178

merged 1 commit into from
Mar 20, 2025

Conversation

zvladru
Copy link

@zvladru zvladru commented Mar 20, 2025

Overview

This PR updates the way the admin email is defined in our codebase. Previously, the STF_ADMIN_EMAIL constant in lib/util/apiutil.js was hard-coded to 'administrator@fakedomain.com', which caused discrepancies when the environment variable was set to a different value.

Changes

  • Modified the declaration of STF_ADMIN_EMAIL so that it now uses:
export const STF_ADMIN_EMAIL = process.env.STF_ADMIN_EMAIL || 'administrator@fakedomain.com';

This way, if the environment variable is defined, its value is used; otherwise, it defaults to 'administrator@fakedomain.com'.

Impact

  • This update will ensure that operations relying on the admin email (e.g. bootstrapping, group lock operations) use the correct email, and it avoids errors such as:
    Error: User with email administrator@fakedomain.com not found or groups field is missing.
    

Testing

  • I tested this change locally and verified that the correct admin email is now used in our API calls.

Notes

  • Please make sure that the environment variable STF_ADMIN_EMAIL is set in your deployment configuration if you want a different admin email than the default.

fix(apiutil): use environment variable for STF_ADMIN_EMAIL

Update the STF_ADMIN_EMAIL constant so that it first takes the value
from process.env.STF_ADMIN_EMAIL and falls back to the default
'administrator@fakedomain.com' if the environment variable is not set.

This change ensures that the admin email used in bootstrapping and group
operations reflects the configuration provided via environment variables,
preventing errors like "User with email administrator@fakedomain.com not found or groups field is missing."
@zvladru zvladru requested a review from a team as a code owner March 20, 2025 12:33
Copy link

@irdkwmnsb irdkwmnsb left a comment

Choose a reason for hiding this comment

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

Nice one!

@irdkwmnsb irdkwmnsb merged commit 8b6df72 into VKCOM:master Mar 20, 2025
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