Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pocketbase --dir does not work #5

Closed
VictorioBerra opened this issue Mar 31, 2024 · 3 comments
Closed

pocketbase --dir does not work #5

VictorioBerra opened this issue Mar 31, 2024 · 3 comments

Comments

@VictorioBerra
Copy link

import { gobot } from "gobot";
import { fileURLToPath } from "url";
import { dirname, join } from "path";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const bot = await gobot(`pocketbase/pocketbase`);
bot.run([`-v`]);
bot.run([`serve --dir ${join(__dirname, "/pb_data")}`]);
pocketbase.exe version 0.22.7
Error: unknown command "serve --dir 'C:\\Users\\toryb\\source\\repos\\Failreactor-Pocketbase - JS\\pb_data'" for "pocketbase.exe"
Run 'pocketbase.exe --help' for usage.

I have my index.js and my /pb_data in the same folder, I think most people will do this. Otherwise, wouldn't upgrading the PB version via GotBot create a new pb_data?

Anways, Gobot is not correctly passing the args to pocketbase it seems. As running the command manually works fine:

C:\Users\toryb\AppData\Local\gobot-nodejs\Cache\pocketbase\pocketbase\archives\0.22.7\x64\win32\pocketbase.exe serve --dir 'C:\\Users\\toryb\\source\\repos\\Failreactor-Pocketbase - JS\\pb_data'

@VictorioBerra
Copy link
Author

VictorioBerra commented Mar 31, 2024

Does not work either (using --dir=X):

bot.run([`serve --dir=${join(__dirname, "pb_data")}`]);

@benallfree
Copy link
Owner

Try each arg as a separate array element.

@VictorioBerra
Copy link
Author

Worked. Thanks!

Final code:

import { gobot } from "gobot";
import { fileURLToPath } from "url";
import { dirname, join } from "path";

// ES Module way to re-create __dirname :/
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const bot = await gobot(`pocketbase/pocketbase`);
bot.run([`-v`]);
bot.run([`serve`, `--dir=${join(__dirname, "pb_data")}`]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants