mirror of
https://github.com/KevinMidboe/brewPi.git
synced 2025-10-29 08:40:13 +00:00
Added brewlogger/brewpi host as env variable
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
ES_CLIENT=http://localhost:3200
|
ES_HOST=http://localhost:3200
|
||||||
ES_INDEX=brewlogger-*
|
ES_INDEX=brewlogger-*
|
||||||
ES_APIKEY=
|
ES_APIKEY=
|
||||||
|
|
||||||
|
BREWLOGGER_HOST=http://127.0.0.1:5000
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import { env } from '$env/dynamic/private';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
const host = 'http://brewpi.schleppe:5000';
|
const host = env.BREWLOGGER_HOST;
|
||||||
const sensorsUrl = `${host}/api/sensors`;
|
const sensorsUrl = `${host}/api/sensors`;
|
||||||
const relaysUrl = `${host}/api/relays`;
|
const relaysUrl = `${host}/api/relays`;
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
import type { RequestHandler } from './$types';
|
||||||
|
|
||||||
// const BREWPI_URL = ''
|
const BREWPI_URL = env.BREWLOGGER_HOST;
|
||||||
const BREWPI_URL = 'http://brewpi.schleppe:5000';
|
|
||||||
|
|
||||||
export const POST = (async ({ request }) => {
|
export const POST = (async (event: RequestEvent) => {
|
||||||
const { pathname } = new URL(request.url);
|
const { pathname } = new URL(event.request.url);
|
||||||
|
|
||||||
const options = { method: 'POST' };
|
const options = { method: 'POST' };
|
||||||
return fetch(BREWPI_URL + pathname, options)
|
return fetch(BREWPI_URL + pathname, options)
|
||||||
|
|||||||
Reference in New Issue
Block a user