]> Untitled Git - lemmy-ui.git/blob - src/shared/env.ts
Fixing docker
[lemmy-ui.git] / src / shared / env.ts
1 import { isBrowser } from './utils';
2
3 const nodeHostname = process.env.LEMMY_HOST || 'localhost'; // used for local dev
4 const host = isBrowser() ? window.location.hostname : nodeHostname;
5 const secure = isBrowser() && window.location.protocol == 'https:' ? 's' : '';
6 const port = isBrowser()
7   ? window.location.port == '1234' || window.location.port == '1235'
8     ? 8536
9     : window.location.port
10   : 8536;
11 const endpoint = `${host}:${port}`;
12
13 export const wsUri = `ws${secure}://${endpoint}/api/v1/ws`;
14 export const httpUri = `http${secure}://${endpoint}/api/v1`;