Skip to content

Commit

Permalink
fix: app-data-path
Browse files Browse the repository at this point in the history
  • Loading branch information
nicotsx committed Nov 21, 2024
1 parent ef9d815 commit 1097441
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/backend/src/common/helpers/env-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export const generateSystemEnvFile = async (): Promise<Map<string, string>> => {
);
}

// Ensure that the app data path does not contain the /app-data suffix
const fixedAppDataPath = data.appDataPath?.split('/app-data')[0];

envMap.set('ROOT_FOLDER_HOST', rootFolderHost);
envMap.set('APPS_REPO_ID', repoId);
envMap.set('APPS_REPO_URL', data.appsRepoUrl || envMap.get('APPS_REPO_URL') || DEFAULT_REPO_URL);
Expand All @@ -96,7 +99,7 @@ export const generateSystemEnvFile = async (): Promise<Map<string, string>> => {
envMap.set('ARCHITECTURE', getArchitecture());
envMap.set('JWT_SECRET', jwtSecret);
envMap.set('DOMAIN', data.domain || envMap.get('DOMAIN') || 'example.com');
envMap.set('RUNTIPI_APP_DATA_PATH', data.appDataPath || envMap.get('RUNTIPI_APP_DATA_PATH') || rootFolderHost);
envMap.set('RUNTIPI_APP_DATA_PATH', fixedAppDataPath || envMap.get('RUNTIPI_APP_DATA_PATH') || rootFolderHost);
envMap.set('POSTGRES_HOST', 'runtipi-db');
envMap.set('POSTGRES_DBNAME', 'tipi');
envMap.set('POSTGRES_USERNAME', 'tipi');
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/core/config/configuration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class ConfigurationService {
}

if (settings.allowErrorMonitoring) {
this.initSentry({ release: this.config.version, allowSentry: true });
this.initSentry({ release: this.config.version, allowSentry: settings.allowErrorMonitoring });
}

const settingsPath = path.join(DATA_DIR, 'state', 'settings.json');
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/modules/apps/app.helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import { ConfigurationService } from '@/core/config/configuration.service';
import { FilesystemService } from '@/core/filesystem/filesystem.service';
import { Injectable } from '@nestjs/common';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ import { Controller, useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { Tooltip } from 'react-tooltip';
import validator from 'validator';
import { z } from 'zod';

const TimeZoneSelector = lazy(() =>
import('@/components/timezone-selector/timezone-selector').then((module) => ({ default: module.TimeZoneSelector })),
);

const settingsSchema = z.object({
appsRepoUrl: z.string().optional(),
localDomain: z.string().optional(),
guestDashboard: z.boolean().optional(),
allowAutoThemes: z.boolean().optional(),
allowErrorMonitoring: z.boolean().optional(),
timeZone: z.string().optional(),
});

export type SettingsFormValues = {
appsRepoUrl?: string;
localDomain?: string;
Expand All @@ -35,7 +45,7 @@ interface IProps {
}

export const UserSettingsForm = (props: IProps) => {
const { onSubmit, initialValues: initalValues, loading, currentLocale = 'en-US', submitErrors } = props;
const { onSubmit, initialValues, loading, currentLocale = 'en-US', submitErrors } = props;
const { t } = useTranslation();

const validateFields = (values: SettingsFormValues) => {
Expand All @@ -58,7 +68,7 @@ export const UserSettingsForm = (props: IProps) => {
setError,
control,
formState: { errors },
} = useForm<SettingsFormValues>({ values: initalValues });
} = useForm<SettingsFormValues>({ values: initialValues });

useEffect(() => {
if (submitErrors) {
Expand All @@ -78,7 +88,7 @@ export const UserSettingsForm = (props: IProps) => {
}

if (Object.keys(validationErrors).length === 0) {
onSubmit(values);
onSubmit(settingsSchema.parse(values));
}
};

Expand Down

0 comments on commit 1097441

Please sign in to comment.