diff --git a/src/bootstrap.ts b/src/bootstrap.ts index 243508b..096426d 100644 --- a/src/bootstrap.ts +++ b/src/bootstrap.ts @@ -2,8 +2,11 @@ import colors from 'colors/safe.js' import {HTTPError} from 'got' import ms from 'ms' import {join} from 'path' +import {fileURLToPath} from 'url' import {Cluster} from './cluster.js' +const __dirname = fileURLToPath(new URL('..', import.meta.url)) + export async function bootstrap(version: string): Promise { console.log(colors.green(`booting openbmclapi ${version}`)) if (!process.env.CLUSTER_PORT) { diff --git a/src/cluster.ts b/src/cluster.ts index 45b817d..3807804 100644 --- a/src/cluster.ts +++ b/src/cluster.ts @@ -19,6 +19,7 @@ import {cwd} from 'process' import ProgressBar from 'progress' import {connect, Socket} from 'socket.io-client' import {Tail} from 'tail' +import {fileURLToPath} from 'url' import {validateFile} from './file.js' import MeasureRoute from './measure.route.js' import {hashToFilename} from './util.js' @@ -32,6 +33,8 @@ interface ICounters { bytes: number } +const __dirname = fileURLToPath(new URL('..', import.meta.url)) + export class Cluster { public readonly counters: ICounters = {hits: 0, bytes: 0} public isEnabled = false