From 664159f669b00bd74d85fcefa8c77e3fcf37a5b8 Mon Sep 17 00:00:00 2001 From: Max schwenk Date: Thu, 9 Nov 2023 21:14:30 -0500 Subject: [PATCH] Add readonly mode --- src/env.ts | 1 + src/plugins/remote-cache/index.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/env.ts b/src/env.ts index 88c26341..c18048b6 100644 --- a/src/env.ts +++ b/src/env.ts @@ -35,6 +35,7 @@ const schema = Type.Object( BODY_LIMIT: Type.Optional(Type.Number({ default: 104857600 })), STORAGE_PATH: Type.Optional(Type.String()), STORAGE_PATH_USE_TMP_FOLDER: Type.Optional(Type.Boolean({ default: true })), + READ_ONLY_MODE: Type.Optional(Type.Boolean({ default: false })), // AWS_ env vars are used as aws-sdk defaults AWS_ACCESS_KEY_ID: Type.Optional(Type.String()), AWS_SECRET_ACCESS_KEY: Type.Optional(Type.String()), diff --git a/src/plugins/remote-cache/index.ts b/src/plugins/remote-cache/index.ts index 539fcfa4..b4098c26 100644 --- a/src/plugins/remote-cache/index.ts +++ b/src/plugins/remote-cache/index.ts @@ -73,7 +73,9 @@ async function turboRemoteCache( i.route(getArtifact) i.route(headArtifact) - i.route(putArtifact) + if (!instance.config.READ_ONLY_MODE) { + i.route(putArtifact); + } i.route(artifactsEvents) }, { prefix: `/${apiVersion}` },