Skip to content

Commit

Permalink
updating reference to webroot
Browse files Browse the repository at this point in the history
  • Loading branch information
MikesGlitch committed Mar 4, 2025
1 parent c62e0bb commit 8a5ba82
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/desktop-electron/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,22 +223,27 @@ async function startSyncServer() {
'app.js',
);

const webRoot = path.join(
// require.resolve will recursively search up the workspace for the module
path.dirname(require.resolve('@actual-app/web/package.json')),
'build',
);

// Use env variables to configure the server
const envVariables: Env = {
let envVariables: Env = {
...process.env, // required
ACTUAL_PORT: `${syncServerConfig.port}`,
ACTUAL_SERVER_FILES: `${syncServerConfig.ACTUAL_SERVER_FILES}`,
ACTUAL_USER_FILES: `${syncServerConfig.ACTUAL_USER_FILES}`,
ACTUAL_DATA_DIR: `${syncServerConfig.ACTUAL_SERVER_DATA_DIR}`,
ACTUAL_WEB_ROOT: webRoot,
};

if (isDev) {
// If we're in dev, use the workspace build of the web app - otherwise use what's in the sync-server (currently an npm package)
// We can remove this isDev condition when sync-server also uses the workspace build
const webRoot = path.join(
// require.resolve will recursively search up the workspace for the module
path.dirname(require.resolve('@actual-app/web/package.json')),
'build',
);

envVariables = { ...envVariables, ACTUAL_WEB_ROOT: webRoot };
}

// ACTUAL_SERVER_DATA_DIR is the root directory for the sync-server
if (!fs.existsSync(syncServerConfig.ACTUAL_SERVER_DATA_DIR)) {
mkdir(syncServerConfig.ACTUAL_SERVER_DATA_DIR, { recursive: true });
Expand Down

0 comments on commit 8a5ba82

Please sign in to comment.