Add support for env variables PRIMAL_CACHE_URL and PRIMAL_UPLOAD_URL.

This commit is contained in:
Bojan Mojsilovic 2023-07-12 13:31:33 +02:00
parent 4e73ec1822
commit 297ccf782e
3 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,9 @@ const onError = (error: Event) => {
export const connect = () => {
if (isNotConnected()) {
const cacheServer = localStorage.getItem('cacheServer') ??
const cacheServer =
localStorage.getItem('cacheServer') ||
import.meta.env.PRIMAL_CACHE_URL ||
'wss://cache3.primal.net/cache17';
setSocket(new WebSocket(cacheServer));

View File

@ -29,7 +29,8 @@ const onError = (error: Event) => {
export const connect = () => {
if (isNotConnected()) {
const cacheServer = localStorage.getItem('uploadServer') ??
const cacheServer = localStorage.getItem('uploadServer') ||
import.meta.env.PRIMAL_UPLOAD_URL ||
'wss://uploads.primal.net/v1';
setSocket(new WebSocket(cacheServer));

View File

@ -10,4 +10,5 @@ export default defineConfig({
target: 'esnext',
sourcemap: true,
},
envPrefix: 'PRIMAL_',
});