Added brewlogger/brewpi host as env variable

This commit is contained in:
2023-05-30 18:12:03 +02:00
parent edb3e74c6d
commit d155637e5f
3 changed files with 10 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
ES_CLIENT=http://localhost:3200
ES_HOST=http://localhost:3200
ES_INDEX=brewlogger-*
ES_APIKEY=
BREWLOGGER_HOST=http://127.0.0.1:5000

View File

@@ -1,6 +1,7 @@
import { env } from '$env/dynamic/private';
import type { PageServerLoad } from './$types';
const host = 'http://brewpi.schleppe:5000';
const host = env.BREWLOGGER_HOST;
const sensorsUrl = `${host}/api/sensors`;
const relaysUrl = `${host}/api/relays`;

View File

@@ -1,11 +1,11 @@
import { json } from '@sveltejs/kit';
import { json, RequestEvent } from '@sveltejs/kit';
import { env } from '$env/dynamic/private';
import type { RequestHandler } from './$types';
// const BREWPI_URL = ''
const BREWPI_URL = 'http://brewpi.schleppe:5000';
const BREWPI_URL = env.BREWLOGGER_HOST;
export const POST = (async ({ request }) => {
const { pathname } = new URL(request.url);
export const POST = (async (event: RequestEvent) => {
const { pathname } = new URL(event.request.url);
const options = { method: 'POST' };
return fetch(BREWPI_URL + pathname, options)