Skip to content

Commit 283f893

Browse files
authored
fix: Add (env) variables to program publish (#139)
1 parent 5b3a1e5 commit 283f893

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/messages/program/publish.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type ProgramPublishConfiguration = {
5353
runtime?: string;
5454
volumes?: MachineVolume[];
5555
metadata?: Record<string, unknown>;
56+
variables?: Record<string, string>;
5657
};
5758

5859
// TODO: Check that program_ref, runtime and data_ref exist
@@ -74,6 +75,7 @@ export async function publish({
7475
vcpus = 1,
7576
runtime = "bd79839bf96e595a06da5ac0b6ba51dea6f7e2591bb913deccded04d831d29f4",
7677
volumes = [],
78+
variables = {},
7779
}: RequireOnlyOne<ProgramPublishConfiguration, "programRef" | "file">): Promise<ProgramMessage> {
7880
const timestamp = Date.now() / 1000;
7981
if (!programRef && !file) throw new Error("You need to specify a file to upload or a programRef to load.");
@@ -138,6 +140,7 @@ export async function publish({
138140
comment: "Aleph Alpine Linux with Python 3.8",
139141
},
140142
volumes,
143+
variables,
141144
};
142145

143146
const message = MessageBuilder<ProgramContent, MessageType.program>({

src/messages/program/spawn.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type ProgramSpawnConfiguration = {
4343
runtime?: string;
4444
volumes?: MachineVolume[];
4545
metadata?: Record<string, unknown>;
46+
variables?: Record<string, string>;
4647
};
4748

4849
export async function Spawn({
@@ -61,6 +62,7 @@ export async function Spawn({
6162
vcpus = 1,
6263
runtime = "bd79839bf96e595a06da5ac0b6ba51dea6f7e2591bb913deccded04d831d29f4",
6364
volumes = [],
65+
variables = {},
6466
}: ProgramSpawnConfiguration): Promise<ProgramMessage> {
6567
return await publish({
6668
account,
@@ -78,5 +80,6 @@ export async function Spawn({
7880
vcpus,
7981
runtime,
8082
volumes,
83+
variables,
8184
});
8285
}

0 commit comments

Comments
 (0)