add ai worker

This commit is contained in:
Ishaan Dey
2024-05-13 23:00:02 -07:00
parent 02c1a6790a
commit 6e67578bf4
15 changed files with 3534 additions and 44 deletions

View File

@ -34,10 +34,8 @@ spec:
cpu: "1"
memory: "1Gi"
env:
- name: CF_API_TOKEN
value: <CF_API_TOKEN>
- name: CF_USER_ID
value: <CF_USER_ID>
- name: CF_AI_KEY
value: <CF_AI_KEY>
---
apiVersion: v1

View File

@ -72,17 +72,11 @@ const readAndParseKubeYaml = (
const regex = new RegExp(`<SANDBOX>`, "g");
docString = docString.replace(regex, sandboxId);
if (!process.env.CF_API_TOKEN) {
throw new Error("CF_API_TOKEN is not defined");
if (!process.env.CF_AI_KEY) {
throw new Error("CF_AI_KEY is not defined");
}
const regexEnv1 = new RegExp(`<CF_API_TOKEN>`, "g");
docString = docString.replace(regexEnv1, process.env.CF_API_TOKEN);
if (!process.env.CF_USER_ID) {
throw new Error("CF_USER_ID is not defined");
}
const regexEnv2 = new RegExp(`<CF_USER_ID>`, "g");
docString = docString.replace(regexEnv2, process.env.CF_USER_ID);
const regexEnv = new RegExp(`<CF_AI_KEY>`, "g");
docString = docString.replace(regexEnv, process.env.CF_AI_KEY);
return yaml.parse(docString);
});