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

schema commands require project even when secret option provided #413

Open
ptpaterson opened this issue Nov 14, 2024 · 1 comment
Open

Comments

@ptpaterson
Copy link
Contributor

ptpaterson commented Nov 14, 2024

The --secret option effectively escapes out of most project configuration options, but schema command initialization always requires a project.

async init() {
await super.init();
if (this.flags?.dir !== undefined) {
this.dir = this.flags.dir;
} else if (this.shellConfig?.projectPath !== undefined) {
if (this.shellConfig.projectConfig?.schemaDir !== undefined) {
this.dir = path.join(
this.shellConfig.projectPath,
this.shellConfig.projectConfig.schemaDir
);
} else {
this.dir = this.shellConfig.projectPath;
}
if (!dirExists(this.dir)) {
this.error(`The project fsl directory: ${this.dir} does not exist.`);
} else if (!dirIsWriteable(this.dir)) {
this.error(`The project fsl directory: ${this.dir} is not writeable.`);
}
} else {
this.error(
"No project found. Create a project with `fauna project init`."
);
}
}

When --secret is used with schema commit, and schema abandon commands, we should not require a project configuration.

Workarounds in the meantime

You can, of course, create a dummy project, but that's a lot of work.

you can add a dummy directory `--dir .' for example:

fauna schema abandon --secret xxxxxxxx --dir .
@fabiotheo
Copy link

Thanks for opening this issue, @ptpaterson. I ran into the same problem when trying to commit a schema using a database key. Your workaround of specifying --dir . worked perfectly for me:

bash
Copiar código
fauna schema commit --secret=xxxxxx --dir .
I appreciate the detailed explanation and the quick fix. This was a great help, and it saved me from having to create a dummy project just for this task. Hopefully, this requirement can be adjusted in a future release to make the CLI even more user-friendly.

Thanks again!

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