mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-23 06:11:58 +00:00
chore: add DEFAULT_LANGUAGE environment variable support (#158)
This commit is contained in:
@@ -138,6 +138,7 @@ echo "Database: SQLite"
|
|||||||
|
|
||||||
# Set global environment variables
|
# Set global environment variables
|
||||||
export DATABASE_URL="file:/app/server/prisma/palmr.db"
|
export DATABASE_URL="file:/app/server/prisma/palmr.db"
|
||||||
|
export NEXT_PUBLIC_DEFAULT_LANGUAGE=\${DEFAULT_LANGUAGE:-en-US}
|
||||||
|
|
||||||
# Ensure /app/server directory exists for bind mounts
|
# Ensure /app/server directory exists for bind mounts
|
||||||
mkdir -p /app/server/uploads /app/server/temp-uploads /app/server/prisma
|
mkdir -p /app/server/uploads /app/server/temp-uploads /app/server/prisma
|
||||||
|
@@ -58,6 +58,7 @@ services:
|
|||||||
- ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY
|
- ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY
|
||||||
# - DISABLE_FILESYSTEM_ENCRYPTION=false # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional)
|
# - DISABLE_FILESYSTEM_ENCRYPTION=false # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional)
|
||||||
# - SECURE_SITE=false # Set to true if you are using a reverse proxy
|
# - SECURE_SITE=false # Set to true if you are using a reverse proxy
|
||||||
|
# - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US)
|
||||||
ports:
|
ports:
|
||||||
- "5487:5487" # Web interface
|
- "5487:5487" # Web interface
|
||||||
- "3333:3333" # API port (OPTIONAL EXPOSED - ONLY IF YOU WANT TO ACCESS THE API DIRECTLY)
|
- "3333:3333" # API port (OPTIONAL EXPOSED - ONLY IF YOU WANT TO ACCESS THE API DIRECTLY)
|
||||||
@@ -107,6 +108,7 @@ services:
|
|||||||
- PALMR_GID=1000 # GID for the container processes (default is 1001)
|
- PALMR_GID=1000 # GID for the container processes (default is 1001)
|
||||||
# - DISABLE_FILESYSTEM_ENCRYPTION=false # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional)
|
# - DISABLE_FILESYSTEM_ENCRYPTION=false # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional)
|
||||||
# - SECURE_SITE=false # Set to true if you are using a reverse proxy
|
# - SECURE_SITE=false # Set to true if you are using a reverse proxy
|
||||||
|
# - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US)
|
||||||
ports:
|
ports:
|
||||||
- "5487:5487" # Web port
|
- "5487:5487" # Web port
|
||||||
- "3333:3333" # API port (OPTIONAL EXPOSED - ONLY IF YOU WANT TO ACCESS THE API DIRECTLY)
|
- "3333:3333" # API port (OPTIONAL EXPOSED - ONLY IF YOU WANT TO ACCESS THE API DIRECTLY)
|
||||||
@@ -130,12 +132,15 @@ docker-compose up -d
|
|||||||
|
|
||||||
Configure Palmr. behavior through environment variables:
|
Configure Palmr. behavior through environment variables:
|
||||||
|
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
| ------------------------------- | ------- | ------------------------------------------------------------------------------------ |
|
| ------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
|
||||||
| `ENABLE_S3` | `false` | Enable S3-compatible storage |
|
| `ENABLE_S3` | `false` | Enable S3-compatible storage |
|
||||||
| `ENCRYPTION_KEY` | - | **Required** (unless encryption disabled): Minimum 32 characters for file encryption |
|
| `ENCRYPTION_KEY` | - | **Required** (unless encryption disabled): Minimum 32 characters for file encryption |
|
||||||
| `DISABLE_FILESYSTEM_ENCRYPTION` | `false` | Disable file encryption for direct filesystem access |
|
| `DISABLE_FILESYSTEM_ENCRYPTION` | `false` | Disable file encryption for direct filesystem access |
|
||||||
| `SECURE_SITE` | `false` | Enable secure cookies for HTTPS/reverse proxy setups |
|
| `SECURE_SITE` | `false` | Enable secure cookies for HTTPS/reverse proxy setups |
|
||||||
|
| `DEFAULT_LANGUAGE` | `en-US` | Set the default application language (see supported languages in docs [here](/docs/3.1-beta/available-languages)) |
|
||||||
|
| `PALMR_UID` | `1001` | Set the UID for the container processes (OPTIONAL - default is 1001) |
|
||||||
|
| `PALMR_GID` | `1001` | Set the GID for the container processes (OPTIONAL - default is 1001) |
|
||||||
|
|
||||||
> **⚠️ Security Warning**: Always change the `ENCRYPTION_KEY` in production when encryption is enabled. This key encrypts your files - losing it makes files permanently inaccessible.
|
> **⚠️ Security Warning**: Always change the `ENCRYPTION_KEY` in production when encryption is enabled. This key encrypts your files - losing it makes files permanently inaccessible.
|
||||||
|
|
||||||
@@ -184,8 +189,11 @@ docker run -d \
|
|||||||
--name palmr \
|
--name palmr \
|
||||||
-e ENABLE_S3=false \
|
-e ENABLE_S3=false \
|
||||||
-e ENCRYPTION_KEY=your-secure-key-min-32-chars \
|
-e ENCRYPTION_KEY=your-secure-key-min-32-chars \
|
||||||
|
# -e PALMR_UID=1000 # UID for the container processes (default is 1001)
|
||||||
|
# -e PALMR_GID=1000 # GID for the container processes (default is 1001)
|
||||||
# -e DISABLE_FILESYSTEM_ENCRYPTION=true # Uncomment to disable file encryption (ENCRYPTION_KEY becomes optional)
|
# -e DISABLE_FILESYSTEM_ENCRYPTION=true # Uncomment to disable file encryption (ENCRYPTION_KEY becomes optional)
|
||||||
# -e SECURE_SITE=false # Set to true if you are using a reverse proxy
|
# -e SECURE_SITE=false # Set to true if you are using a reverse proxy
|
||||||
|
# -e DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US)
|
||||||
-p 5487:5487 \
|
-p 5487:5487 \
|
||||||
-p 3333:3333 \
|
-p 3333:3333 \
|
||||||
-v palmr_data:/app/server \
|
-v palmr_data:/app/server \
|
||||||
@@ -206,6 +214,7 @@ docker run -d \
|
|||||||
-e PALMR_GID=1000 # GID for the container processes (default is 1001)
|
-e PALMR_GID=1000 # GID for the container processes (default is 1001)
|
||||||
# -e DISABLE_FILESYSTEM_ENCRYPTION=true # Uncomment to disable file encryption (ENCRYPTION_KEY becomes optional)
|
# -e DISABLE_FILESYSTEM_ENCRYPTION=true # Uncomment to disable file encryption (ENCRYPTION_KEY becomes optional)
|
||||||
# -e SECURE_SITE=false # Set to true if you are using a reverse proxy
|
# -e SECURE_SITE=false # Set to true if you are using a reverse proxy
|
||||||
|
# -e DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US)
|
||||||
-p 5487:5487 \
|
-p 5487:5487 \
|
||||||
-p 3333:3333 \
|
-p 3333:3333 \
|
||||||
-v $(pwd)/data:/app/server \
|
-v $(pwd)/data:/app/server \
|
||||||
|
@@ -1 +1,2 @@
|
|||||||
API_BASE_URL=http:localhost:3333
|
API_BASE_URL=http:localhost:3333
|
||||||
|
NEXT_PUBLIC_DEFAULT_LANGUAGE=en-US
|
@@ -1,7 +1,9 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
import { version } from "../../../../../../package.json";
|
import packageJson from "../../../../../../package.json";
|
||||||
|
|
||||||
|
const { version } = packageJson;
|
||||||
|
|
||||||
export function TransparentFooter() {
|
export function TransparentFooter() {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
@@ -65,7 +65,7 @@ export function LanguageSwitcher() {
|
|||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end">
|
<DropdownMenuContent align="end">
|
||||||
{Object.entries(languages).map(([code, name]) => {
|
{Object.entries(languages).map(([code, name]) => {
|
||||||
const isCurrentLocale = locale === code.split("-")[0];
|
const isCurrentLocale = locale === code;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
|
@@ -1,7 +1,26 @@
|
|||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { getRequestConfig } from "next-intl/server";
|
import { getRequestConfig } from "next-intl/server";
|
||||||
|
|
||||||
const DEFAULT_LOCALE = "en-US";
|
const supportedLocales = [
|
||||||
|
"en-US",
|
||||||
|
"pt-BR",
|
||||||
|
"fr-FR",
|
||||||
|
"es-ES",
|
||||||
|
"de-DE",
|
||||||
|
"it-IT",
|
||||||
|
"nl-NL",
|
||||||
|
"pl-PL",
|
||||||
|
"tr-TR",
|
||||||
|
"ru-RU",
|
||||||
|
"hi-IN",
|
||||||
|
"ar-SA",
|
||||||
|
"zh-CN",
|
||||||
|
"ja-JP",
|
||||||
|
"ko-KR",
|
||||||
|
];
|
||||||
|
|
||||||
|
const envDefault = process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || "en-US";
|
||||||
|
const DEFAULT_LOCALE = supportedLocales.includes(envDefault) ? envDefault : "en-US";
|
||||||
|
|
||||||
export default getRequestConfig(async ({ locale }) => {
|
export default getRequestConfig(async ({ locale }) => {
|
||||||
const cookieStore = cookies();
|
const cookieStore = cookies();
|
||||||
@@ -9,11 +28,12 @@ export default getRequestConfig(async ({ locale }) => {
|
|||||||
const localeCookie = cookiesList.get("NEXT_LOCALE");
|
const localeCookie = cookiesList.get("NEXT_LOCALE");
|
||||||
|
|
||||||
const resolvedLocale = localeCookie?.value || locale || DEFAULT_LOCALE;
|
const resolvedLocale = localeCookie?.value || locale || DEFAULT_LOCALE;
|
||||||
|
const finalLocale = supportedLocales.includes(resolvedLocale) ? resolvedLocale : DEFAULT_LOCALE;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return {
|
return {
|
||||||
locale: resolvedLocale,
|
locale: finalLocale,
|
||||||
messages: (await import(`../../messages/${resolvedLocale}.json`)).default,
|
messages: (await import(`../../messages/${finalLocale}.json`)).default,
|
||||||
};
|
};
|
||||||
} catch {
|
} catch {
|
||||||
return {
|
return {
|
||||||
|
@@ -7,6 +7,7 @@ services:
|
|||||||
- ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY (REQUIRED if DISABLE_FILESYSTEM_ENCRYPTION is false)
|
- ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY (REQUIRED if DISABLE_FILESYSTEM_ENCRYPTION is false)
|
||||||
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
|
# - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs for see all supported languages
|
||||||
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
||||||
# - DISABLE_FILESYSTEM_ENCRYPTION=true # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) | (OPTIONAL - default is false)
|
# - DISABLE_FILESYSTEM_ENCRYPTION=true # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) | (OPTIONAL - default is false)
|
||||||
ports:
|
ports:
|
||||||
|
@@ -14,6 +14,7 @@ services:
|
|||||||
- S3_FORCE_PATH_STYLE=true # For MinIO compatibility we have to set this to true
|
- S3_FORCE_PATH_STYLE=true # For MinIO compatibility we have to set this to true
|
||||||
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
|
# - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs for see all supported languages
|
||||||
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
||||||
ports:
|
ports:
|
||||||
- "5487:5487" # Web port
|
- "5487:5487" # Web port
|
||||||
|
@@ -14,6 +14,7 @@ services:
|
|||||||
- S3_FORCE_PATH_STYLE=false # For S3 compatibility we have to set this to false
|
- S3_FORCE_PATH_STYLE=false # For S3 compatibility we have to set this to false
|
||||||
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
|
# - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs for see all supported languages
|
||||||
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
||||||
ports:
|
ports:
|
||||||
- "5487:5487" # Web port
|
- "5487:5487" # Web port
|
||||||
|
@@ -7,6 +7,7 @@ services:
|
|||||||
- ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY (REQUIRED if DISABLE_FILESYSTEM_ENCRYPTION is false)
|
- ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY (REQUIRED if DISABLE_FILESYSTEM_ENCRYPTION is false)
|
||||||
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
- PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information
|
||||||
|
# - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs to see all supported languages
|
||||||
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
# - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false)
|
||||||
# - DISABLE_FILESYSTEM_ENCRYPTION=true # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) | (OPTIONAL - default is false)
|
# - DISABLE_FILESYSTEM_ENCRYPTION=true # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) | (OPTIONAL - default is false)
|
||||||
ports:
|
ports:
|
||||||
|
Reference in New Issue
Block a user