fix: do not error if proxy is not running
This commit is contained in:
@@ -112,9 +112,15 @@ export async function haproxyInstance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function configureHAProxy() {
|
export async function configureHAProxy() {
|
||||||
try {
|
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
|
|
||||||
|
try {
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
|
} catch (error) {
|
||||||
|
return 'Error: HAProxy is not running';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const data = {
|
const data = {
|
||||||
applications: [],
|
applications: [],
|
||||||
services: [],
|
services: [],
|
||||||
|
@@ -49,7 +49,12 @@ export async function completeTransaction(transactionId) {
|
|||||||
}
|
}
|
||||||
export async function deleteProxy({ id }) {
|
export async function deleteProxy({ id }) {
|
||||||
const haproxy = await haproxyInstance();
|
const haproxy = await haproxyInstance();
|
||||||
|
try {
|
||||||
await checkHAProxy(haproxy);
|
await checkHAProxy(haproxy);
|
||||||
|
} catch (error) {
|
||||||
|
return 'Error: HAProxy is not running';
|
||||||
|
}
|
||||||
|
|
||||||
let transactionId;
|
let transactionId;
|
||||||
try {
|
try {
|
||||||
await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json();
|
await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json();
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import { dev } from '$app/env';
|
|
||||||
import { ErrorHandler } from '$lib/database';
|
import { ErrorHandler } from '$lib/database';
|
||||||
import { configureHAProxy } from '$lib/haproxy/configuration';
|
import { configureHAProxy } from '$lib/haproxy/configuration';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user