Skip to content

Commit 67a33e7

Browse files
authored
Add apphosting config interface to common. (#385)
- Add interfaces for the apphosting config, while sharing what can be shared with the bundle config - remove unused and duplicate interfaces in adapter-angular - Add 'Build' enum value for envvars availability. This was previously limited to "Runtime" because it was used only for bundle.yaml's envvars which are envvars set by the adapter after a build to be used for runtime. Now the envvars interface will be shared with the apphosting config
1 parent 62ec239 commit 67a33e7

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

packages/@apphosting/adapter-angular/src/interface.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,6 @@ export interface OutputBundleOptions {
99
needsServerGenerated: boolean;
1010
}
1111

12-
// Environment variable schema for bundle.yaml outputted by angular adapter
13-
export interface EnvironmentVariable {
14-
variable: string;
15-
value: string;
16-
availability: Availability.Runtime; // currently support RUNTIME only
17-
}
18-
19-
// defines whether the environment variable is buildtime, runtime or both
20-
export enum Availability {
21-
Buildtime = "BUILD",
22-
Runtime = "RUNTIME",
23-
}
24-
25-
// Metadata schema for bundle.yaml outputted by angular adapter
26-
export interface Metadata {
27-
adapterPackageName: string;
28-
adapterVersion: string;
29-
framework: string;
30-
frameworkVersion: string;
31-
}
32-
3312
// valid manifest schema
3413
export interface ValidManifest {
3514
errors: string[];

packages/@apphosting/common/src/index.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { spawn } from "child_process";
22
import * as fs from "node:fs";
33
import * as path from "node:path";
44

5+
// **** OutputBundleConfig interfaces ****
6+
57
// Output bundle metadata specifications to be written to bundle.yaml
68
export interface OutputBundleConfig {
79
version: "v1";
@@ -41,9 +43,31 @@ export interface Metadata {
4143
frameworkVersion?: string;
4244
}
4345

46+
// **** Apphosting Config interfaces ****
47+
48+
export interface ApphostingConfig {
49+
runconfig?: ApphostingRunConfig;
50+
env?: EnvVarConfig[];
51+
scripts?: Script;
52+
outputFiles?: OutputFiles;
53+
}
54+
55+
export interface ApphostingRunConfig {
56+
minInstances?: number;
57+
maxInstances?: number;
58+
concurrency?: number;
59+
}
60+
61+
export interface Script {
62+
buildCommand?: string;
63+
runCommand?: string;
64+
}
65+
66+
// **** Shared interfaces ****
67+
4468
// Optional outputFiles to configure outputFiles and optimize server files + static assets.
4569
// If this is not set then all of the source code will be uploaded
46-
interface OutputFiles {
70+
export interface OutputFiles {
4771
serverApp: ServerApp;
4872
}
4973

@@ -59,14 +83,15 @@ export interface EnvVarConfig {
5983
variable: string;
6084
// Value associated with the variable
6185
value: string;
62-
// Where the variable will be available, for now only RUNTIME is supported
63-
availability: Availability.Runtime[];
86+
// Where the variable will be available
87+
availability: Availability[];
6488
}
6589

6690
// Represents where environment variables are made available
6791
export enum Availability {
6892
// Runtime environment variables are available on the server when the app is run
6993
Runtime = "RUNTIME",
94+
Build = "BUILD",
7095
}
7196

7297
// Options to configure the build of a framework application

0 commit comments

Comments
 (0)