tursodatabase / turso-cli

Command line interface to Turso.
https://turso.tech
MIT License
229 stars 37 forks source link

Remove `auth` requirement for unless needed #879

Closed bryanvaz closed 5 months ago

bryanvaz commented 5 months ago

Ran into a "fun" CI brick wall which might require an internal Turso business strategy discussion. No point in submitting a PR if behaviour is intentional.

Problem:

When running test suites in a CI pipeline and trying to load fixtures into a local libsql docker using turso db shell, the CI runner gets hit with the fun message:

You are not logged in, please login with turso auth login before running other commands.

This should also fail if the CI attempted to spin up a turso dev instance.

Personally, I prefer deterministic test suites, which in part means that internet connectivity and remote services should not be part of a test unless those remote services (and/or internet connectivity) are specifically being tested in some way. In theory, there should be no reason to require an auth/api token for local turso/libsql activity.

Proposed Solution

Current Workaround: Set TURSO_API_TOKEN env variable to any non-null value

Rationale

Whether or not this is a bug or an intentional feature should be based on two things:

  1. What is the business strategy and purpose of the turso-cli and its relationship to the libsql repo?
  2. Should turso-cli support automated, deterministic, offline databases, and offline CI pipelines? (and how should they be supported?)

I've outlined two sides of the strategy this issue could fall into, but obviously there could be other views depending on what the actual business strategy is.

1. turso-cli is primarily for facilitating Turso customers

2. turso-cli is the defacto client for libsql, in addition to Turso paid services

haaawk commented 5 months ago

Thanks for reporting the issue @bryanvaz - 0.95.2 has the fix

bryanvaz commented 5 months ago

Hey Piotr, (@haaawk) I just reviewed the PR. Did you want to include the other side of the command as well, i.e. local dev databases?

❯ turso dev --db-file /tmp/local.db
You are not logged in, please login with turso auth login before running other commands.

Again goes to the strategy of whether people should be using turso-cli or libsql for self-hosted databases for local dev and CI

haaawk commented 5 months ago

Sure -> https://github.com/tursodatabase/turso-cli/pull/882