Podpora načítání .env na serveru dle prostředí
This commit is contained in:
parent
97aa41549b
commit
4e8ff4d8a3
@ -2,9 +2,14 @@
|
||||
import axios, {AxiosError, AxiosResponse} from 'axios';
|
||||
import {GotifyServer, NotififaceInput, NotifikaceData, UdalostEnum} from "./types";
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config()
|
||||
import path from 'path';
|
||||
|
||||
const ENVIRONMENT = process.env.NODE_ENV || 'production'
|
||||
dotenv.config({ path: path.resolve(__dirname, `../.env.${ENVIRONMENT}`) });
|
||||
|
||||
const gotifyDataRaw = process.env.GOTIFY_SERVERS_AND_KEYS || "{}";
|
||||
const gotifyData: GotifyServer[] = JSON.parse(gotifyDataRaw);
|
||||
|
||||
export const gotifyCall = async (data: NotififaceInput, gotifyServers: GotifyServer[]): Promise<any[]> => {
|
||||
const urls = gotifyServers.flatMap(gotifyServer =>
|
||||
gotifyServer.api_keys.map(apiKey => `${gotifyServer.server}/message?token=${apiKey}`));
|
||||
|
Loading…
x
Reference in New Issue
Block a user