mirror of
https://github.com/unraid/api.git
synced 2026-02-05 23:48:59 -06:00
36 lines
984 B
TypeScript
36 lines
984 B
TypeScript
import { config } from './core/config';
|
|
|
|
const internalWsAddress = () => {
|
|
const port = config.get('port') as number | string;
|
|
return isNaN(port as any) ?
|
|
// Unix Socket
|
|
`ws+unix:${port}` :
|
|
// Numbered port
|
|
`ws://localhost:${port}`;
|
|
};
|
|
|
|
/**
|
|
* One second in milliseconds.
|
|
*/
|
|
export const ONE_SECOND = 1000;
|
|
|
|
/**
|
|
* One minute in milliseconds.
|
|
*/
|
|
export const ONE_MINUTE = 60 * ONE_SECOND;
|
|
|
|
/**
|
|
* Relay ws link.
|
|
*/
|
|
export const MOTHERSHIP_RELAY_WS_LINK = process.env.MOTHERSHIP_RELAY_WS_LINK ?? (process.env.ENVIRONMENT === 'staging' ? 'wss://staging.mothership.unraid.net/relay' : 'wss://mothership.unraid.net/relay');
|
|
|
|
/**
|
|
* Graphql link.
|
|
*/
|
|
export const MOTHERSHIP_GRAPHQL_LINK = process.env.MOTHERSHIP_GRAPHQL_LINK ?? (process.env.ENVIRONMENT === 'staging' ? 'https://staging.mothership.unraid.net/graphql' : 'https://mothership.unraid.net/graphql');
|
|
|
|
/**
|
|
* Internal ws link.
|
|
*/
|
|
export const INTERNAL_WS_LINK = process.env.INTERNAL_WS_LINK ?? internalWsAddress();
|