mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-23 22:27:17 -04:00
no log: fix vite configuration linter
This commit is contained in:
parent
74494d2edc
commit
d4efdedd4d
2 changed files with 7 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
/* eslint-disable no-console */
|
||||
/// <reference types="node" />
|
||||
|
||||
import { readFile } from "fs/promises";
|
||||
import { readFileSync } from "fs";
|
||||
import { get } from "lodash";
|
||||
import { parse } from "yaml";
|
||||
|
||||
|
@ -12,9 +12,9 @@ class ConfigReader {
|
|||
this.config = {};
|
||||
}
|
||||
|
||||
async open(path: string) {
|
||||
open(path: string) {
|
||||
try {
|
||||
const rawConfig = await readFile(path, "utf8");
|
||||
const rawConfig = readFileSync(path, "utf8");
|
||||
this.config = parse(rawConfig);
|
||||
} catch (err) {
|
||||
// We don't want to catch the error here, handle it on getValue method
|
||||
|
@ -33,7 +33,7 @@ class ConfigReader {
|
|||
}
|
||||
}
|
||||
|
||||
export default async function overrideEnv(env: Record<string, string>) {
|
||||
export default function overrideEnv(env: Record<string, string>) {
|
||||
const configPath = env["VITE_BAZARR_CONFIG_FILE"];
|
||||
|
||||
if (configPath === undefined) {
|
||||
|
@ -41,7 +41,7 @@ export default async function overrideEnv(env: Record<string, string>) {
|
|||
}
|
||||
|
||||
const reader = new ConfigReader();
|
||||
await reader.open(configPath);
|
||||
reader.open(configPath);
|
||||
|
||||
if (env["VITE_API_KEY"] === undefined) {
|
||||
try {
|
||||
|
|
|
@ -12,11 +12,11 @@ import { VitePWA } from "vite-plugin-pwa";
|
|||
import chunks from "./config/chunks";
|
||||
import overrideEnv from "./config/configReader";
|
||||
|
||||
export default defineConfig(async ({ mode, command }) => {
|
||||
export default defineConfig(({ mode, command }) => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
|
||||
if (command === "serve") {
|
||||
await overrideEnv(env);
|
||||
overrideEnv(env);
|
||||
}
|
||||
|
||||
const target = env.VITE_PROXY_URL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue