Skip to content

Commit 853cc56

Browse files
committed
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 60278c4 commit 853cc56

2 files changed

Lines changed: 29 additions & 24 deletions

File tree

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: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { spawn } from "child_process";
22
import * as fs from "node:fs";
33
import * as path from "node:path";
44

5+
56
// List of apphosting supported frameworks.
67
export const SupportedFrameworks = ['nextjs', 'angular'];
78

9+
// **** OutputBundleConfig interfaces ****
10+
811
// Output bundle metadata specifications to be written to bundle.yaml
912
export interface OutputBundleConfig {
1013
version: "v1";
@@ -44,9 +47,31 @@ export interface Metadata {
4447
frameworkVersion?: string;
4548
}
4649

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

@@ -62,14 +87,15 @@ export interface EnvVarConfig {
6287
variable: string;
6388
// Value associated with the variable
6489
value: string;
65-
// Where the variable will be available, for now only RUNTIME is supported
66-
availability: Availability.Runtime[];
90+
// Where the variable will be available
91+
availability: Availability[];
6792
}
6893

6994
// Represents where environment variables are made available
7095
export enum Availability {
7196
// Runtime environment variables are available on the server when the app is run
7297
Runtime = "RUNTIME",
98+
Build = "BUILD",
7399
}
74100

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

0 commit comments

Comments
 (0)