Skip to content

Commit abb547f

Browse files
authored
Allow Expressions in the top-level configuration of v1 functions (#1255)
1 parent 8e71eca commit abb547f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/v1/function-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import * as testLab from "./providers/testLab";
5353
*/
5454
function assertRuntimeOptionsValid(runtimeOptions: RuntimeOptions): boolean {
5555
const mem = runtimeOptions.memory;
56-
if (mem && !(mem instanceof ResetValue) && !VALID_MEMORY_OPTIONS.includes(mem)) {
56+
if (mem && typeof mem !== "object" && !VALID_MEMORY_OPTIONS.includes(mem)) {
5757
throw new Error(
5858
`The only valid memory allocation values are: ${VALID_MEMORY_OPTIONS.join(", ")}`
5959
);

src/v1/function-configuration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ export interface RuntimeOptions {
178178
/**
179179
* Amount of memory to allocate to the function.
180180
*/
181-
memory?: typeof VALID_MEMORY_OPTIONS[number] | ResetValue;
181+
memory?: typeof VALID_MEMORY_OPTIONS[number] | Expression<number> | ResetValue;
182182
/**
183183
* Timeout for the function in seconds, possible values are 0 to 540.
184184
*/
185-
timeoutSeconds?: number | ResetValue;
185+
timeoutSeconds?: number | Expression<number> | ResetValue;
186186

187187
/**
188188
* Min number of actual instances to be running at a given time.
@@ -191,12 +191,12 @@ export interface RuntimeOptions {
191191
* Instances will be billed for memory allocation and 10% of CPU allocation
192192
* while idle.
193193
*/
194-
minInstances?: number | ResetValue;
194+
minInstances?: number | Expression<number> | ResetValue;
195195

196196
/**
197197
* Max number of actual instances allowed to be running in parallel.
198198
*/
199-
maxInstances?: number | ResetValue;
199+
maxInstances?: number | Expression<number> | ResetValue;
200200

201201
/**
202202
* Connect cloud function to specified VPC connector.

0 commit comments

Comments
 (0)