Updated handling of env vars.

This commit is contained in:
Mike Cao 2024-05-11 21:52:40 -07:00
parent abd0913e9b
commit 30c1933718
8 changed files with 192 additions and 155 deletions

View file

@ -15,14 +15,7 @@ import { WebsiteContext } from 'app/(main)/websites/[websiteId]/WebsiteProvider'
const generateId = () => getRandomChars(16);
export function ShareUrl({
hostUrl,
onSave,
}: {
websiteId: string;
hostUrl?: string;
onSave?: () => void;
}) {
export function ShareUrl({ onSave }: { websiteId: string; onSave?: () => void }) {
const website = useContext(WebsiteContext);
const { domain, shareId } = website;
const { formatMessage, labels, messages } = useMessages();
@ -33,8 +26,8 @@ export function ShareUrl({
});
const { touch } = useModified();
const url = `${hostUrl || process.env.hostUrl || window?.location.origin}${
process.env.basePath
const url = `${process.env.shareUrlHost || window?.location.origin || ''}${
process.env.basePath || ''
}/share/${id}/${domain}`;
const handleGenerate = () => {