Skip to content

Add RESET_VALUE configuration value as sentinel value to reset a config option. #1250

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

Merged
merged 13 commits into from
Oct 5, 2022

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Oct 3, 2022

Instead of allowing nulls to reset a configuration value, we are introducing a new sentinel value, RESET_VALUE to make it clear the intention of resetting the config value to platform default:

import * as functions from "firebase-functions/v1";
import { onRequest } from "firebase-functions/v2/https";
import { RESET_VALUE } from "firebase-functions/v2/options";

export const v1Req = functions
  .runWith({
    minInstances: functions.RESET_VALUE,
    memory: functions.RESET_VALUE,
    serviceAccount: RESET_VALUE
  }).https.onRequest(
    (req, res) => {
      res.sendStatus(200)
    },
);

export const v2Req = onRequest(
  {
   memory: RESET_VALUE,
   minInstances: RESET_VALUE,
  },
  (req, res) => {
    res.sendStatus(200)
  },
);

Majority of this PR concerns fixing/updating typings on various configuration options.

Recall that in v2, we inlined/repeat all function options in each respective providers to make reference doc more clear. This unfortunately bloated up this PR since I had to repeat the changes in each and every provider.

@taeold
Copy link
Contributor Author

taeold commented Oct 3, 2022

@taeold taeold mentioned this pull request Oct 3, 2022
@taeold taeold changed the title Dl reset values Add RESET_VALUE configuration value as sentinel value to reset a config option. Oct 5, 2022
@taeold taeold marked this pull request as ready for review October 5, 2022 16:17
@taeold taeold requested review from Berlioz, colerogers and TheIronDev and removed request for Berlioz October 5, 2022 16:17
Copy link
Contributor

@TheIronDev TheIronDev left a comment

Choose a reason for hiding this comment

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

Had a few questions to make sure some changes were intentional, otherwise LGTM

@taeold taeold merged commit 8a2c826 into launch.next Oct 5, 2022
@taeold taeold added this to the v4 milestone Oct 6, 2022
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.

3 participants