aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/web/app/api/assets/route.ts2
-rw-r--r--docs/docs/03-configuration.md24
-rw-r--r--packages/shared/config.ts2
3 files changed, 16 insertions, 12 deletions
diff --git a/apps/web/app/api/assets/route.ts b/apps/web/app/api/assets/route.ts
index 838bcce1..0bb2f778 100644
--- a/apps/web/app/api/assets/route.ts
+++ b/apps/web/app/api/assets/route.ts
@@ -11,7 +11,7 @@ const SUPPORTED_ASSET_TYPES = new Set([
"image/webp",
]);
-const MAX_UPLOAD_SIZE_BYTES = 4 * 1024 * 1024;
+const MAX_UPLOAD_SIZE_BYTES = serverConfig.maxAssetSizeMb * 1024 * 1024;
export const dynamic = "force-dynamic";
export async function POST(request: Request) {
diff --git a/docs/docs/03-configuration.md b/docs/docs/03-configuration.md
index 0300717f..e84d6d96 100644
--- a/docs/docs/03-configuration.md
+++ b/docs/docs/03-configuration.md
@@ -2,25 +2,27 @@
The app is mainly configured by environment variables. All the used environment variables are listed in [packages/shared/config.ts](https://github.com/MohamedBassem/hoarder-app/blob/main/packages/shared/config.ts). The most important ones are:
-| Name | Required | Default | Description |
-| ---------------- | ------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
-| DATA_DIR | Yes | Not set | The path for the persistent data directory. This is where the db and the uploaded assets live. |
-| NEXTAUTH_SECRET | Yes | Not set | Random string used to sign the JWT tokens. Generate one with `openssl rand -base64 36`. |
-| REDIS_HOST | Yes | localhost | The address of redis used by background jobs |
-| REDIS_POST | Yes | 6379 | The port of redis used by background jobs |
-| REDIS_DB_IDX | No | Not set | The db idx to use with redis. It defaults to 0 (in the client) so you don't usually need to set it unless you explicitly want another db. |
-| MEILI_ADDR | No | Not set | The address of meilisearch. If not set, Search will be disabled. E.g. (`http://meilisearch:7700`) |
-| MEILI_MASTER_KEY | Only in Prod and if search is enabled | Not set | The master key configured for meilisearch. Not needed in development environment. Generate one with `openssl rand -base64 36` |
-| DISABLE_SIGNUPS | No | false | If enabled, no new signups will be allowed and the signup button will be disabled in the UI |
+| Name | Required | Default | Description |
+| ----------------- | ------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
+| DATA_DIR | Yes | Not set | The path for the persistent data directory. This is where the db and the uploaded assets live. |
+| NEXTAUTH_SECRET | Yes | Not set | Random string used to sign the JWT tokens. Generate one with `openssl rand -base64 36`. |
+| REDIS_HOST | Yes | localhost | The address of redis used by background jobs |
+| REDIS_POST | Yes | 6379 | The port of redis used by background jobs |
+| REDIS_DB_IDX | No | Not set | The db idx to use with redis. It defaults to 0 (in the client) so you don't usually need to set it unless you explicitly want another db. |
+| MEILI_ADDR | No | Not set | The address of meilisearch. If not set, Search will be disabled. E.g. (`http://meilisearch:7700`) |
+| MEILI_MASTER_KEY | Only in Prod and if search is enabled | Not set | The master key configured for meilisearch. Not needed in development environment. Generate one with `openssl rand -base64 36` |
+| DISABLE_SIGNUPS | No | false | If enabled, no new signups will be allowed and the signup button will be disabled in the UI |
+| MAX_ASSET_SIZE_MB | No | 4 | Sets the maximum allowed asset size (in MB) to be uploaded |
## Inference Configs (For automatic tagging)
Either `OPENAI_API_KEY` or `OLLAMA_BASE_URL` need to be set for automatic tagging to be enabled. Otherwise, automatic tagging will be skipped.
:::warning
+
- The quality of the tags you'll get will depend on the quality of the model you choose.
- Running local models is a recent addition and not as battle tested as using OpenAI, so proceed with care (and potentially expect a bunch of inference failures).
-:::
+ :::
| Name | Required | Default | Description |
| --------------------- | -------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
diff --git a/packages/shared/config.ts b/packages/shared/config.ts
index edc96627..c7c5666a 100644
--- a/packages/shared/config.ts
+++ b/packages/shared/config.ts
@@ -29,6 +29,7 @@ const allEnv = z.object({
DEMO_MODE_EMAIL: z.string().optional(),
DEMO_MODE_PASSWORD: z.string().optional(),
DATA_DIR: z.string().default(""),
+ MAX_ASSET_SIZE_MB: z.coerce.number().default(4),
});
const serverConfigSchema = allEnv.transform((val) => {
@@ -69,6 +70,7 @@ const serverConfigSchema = allEnv.transform((val) => {
}
: undefined,
dataDir: val.DATA_DIR,
+ maxAssetSizeMb: val.MAX_ASSET_SIZE_MB,
};
});