mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-23 06:11:58 +00:00
feat: add CUSTOM_PATH environment variable for dynamic storage paths (#247)
This commit is contained in:
@@ -201,6 +201,17 @@ You should see the full Palmr. application ready to go!
|
|||||||
|
|
||||||
This guide sets up Palmr. using the local file system for storage. Want to use an S3-compatible object storage instead? You can configure that in the `.env` file. Check the Palmr. documentation for details on setting up S3 storage just update the environment variables, then build and run as shown here.
|
This guide sets up Palmr. using the local file system for storage. Want to use an S3-compatible object storage instead? You can configure that in the `.env` file. Check the Palmr. documentation for details on setting up S3 storage just update the environment variables, then build and run as shown here.
|
||||||
|
|
||||||
|
### Custom Installation Paths and Symlinks
|
||||||
|
|
||||||
|
If you're using a custom installation setup with symlinks (for example, `/opt/palmr_data/uploads -> /mnt/data/uploads`), you might encounter issues with disk space detection. Palmr. includes a `CUSTOM_PATH` environment variable to handle these scenarios:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# In your .env file (apps/server/.env)
|
||||||
|
CUSTOM_PATH=/opt/palmr_data
|
||||||
|
```
|
||||||
|
|
||||||
|
This tells Palmr. to check your custom path first when determining available disk space, ensuring proper detection even when using symlinks or non-standard directory structures.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Command cheat sheet
|
## Command cheat sheet
|
||||||
|
@@ -166,6 +166,7 @@ Customize Palmr's behavior with these environment variables:
|
|||||||
| `ENCRYPTION_KEY` | - | **Required when encryption is enabled**: 32+ character key for file encryption |
|
| `ENCRYPTION_KEY` | - | **Required when encryption is enabled**: 32+ character key for file encryption |
|
||||||
| `DISABLE_FILESYSTEM_ENCRYPTION` | `true` | Disable file encryption for better performance (set to `false` to enable encryption) |
|
| `DISABLE_FILESYSTEM_ENCRYPTION` | `true` | Disable file encryption for better performance (set to `false` to enable encryption) |
|
||||||
| `PRESIGNED_URL_EXPIRATION` | `3600` | Duration in seconds for presigned URL expiration (applies to both filesystem and S3 storage) |
|
| `PRESIGNED_URL_EXPIRATION` | `3600` | Duration in seconds for presigned URL expiration (applies to both filesystem and S3 storage) |
|
||||||
|
| `CUSTOM_PATH` | - | Custom base path for disk space detection in manual installations with symlinks |
|
||||||
| `SECURE_SITE` | `false` | Enable secure cookies for HTTPS/reverse proxy deployments |
|
| `SECURE_SITE` | `false` | Enable secure cookies for HTTPS/reverse proxy deployments |
|
||||||
| `DEFAULT_LANGUAGE` | `en-US` | Default application language ([see available languages](/docs/3.2-beta/available-languages)) |
|
| `DEFAULT_LANGUAGE` | `en-US` | Default application language ([see available languages](/docs/3.2-beta/available-languages)) |
|
||||||
| `PALMR_UID` | `1000` | User ID for container processes (helps with file permissions) |
|
| `PALMR_UID` | `1000` | User ID for container processes (helps with file permissions) |
|
||||||
|
@@ -33,6 +33,7 @@ const envSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.optional()
|
.optional()
|
||||||
.transform((val) => (val ? parseFloat(val) : undefined)),
|
.transform((val) => (val ? parseFloat(val) : undefined)),
|
||||||
|
CUSTOM_PATH: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const env = envSchema.parse(process.env);
|
export const env = envSchema.parse(process.env);
|
||||||
|
@@ -284,7 +284,7 @@ export class StorageService {
|
|||||||
private async _getDiskSpaceMultiplePaths(): Promise<{ total: number; available: number } | null> {
|
private async _getDiskSpaceMultiplePaths(): Promise<{ total: number; available: number } | null> {
|
||||||
const basePaths = IS_RUNNING_IN_CONTAINER
|
const basePaths = IS_RUNNING_IN_CONTAINER
|
||||||
? ["/app/server/uploads", "/app/server/temp-uploads", "/app/server/temp-chunks", "/app/server", "/app", "/"]
|
? ["/app/server/uploads", "/app/server/temp-uploads", "/app/server/temp-chunks", "/app/server", "/app", "/"]
|
||||||
: [".", "./uploads", process.cwd()];
|
: [env.CUSTOM_PATH || ".", "./uploads", process.cwd()];
|
||||||
|
|
||||||
const synologyPaths = await this._detectSynologyVolumes();
|
const synologyPaths = await this._detectSynologyVolumes();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user