aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/routes/actual.remote.ts
blob: bcf5d3736b3cc1cfb40a64b010e512bf54f4040f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { command } from "$app/server";
import { ACTUAL_HOST, ACTUAL_PASS } from "$env/static/private";
import * as actual from "@actual-app/api"
import { existsSync, mkdirSync } from "node:fs";
import path from "node:path";

export const initActual = command(async () => {
    const dataDir = path.resolve(__dirname, "actualDataDir");

    if (!existsSync(dataDir)) mkdirSync(dataDir);

    return actual.init({
        password: ACTUAL_PASS,
        serverURL: ACTUAL_HOST,
        dataDir: dataDir
    })
})