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

Use $DATASETTE_INTERNAL in absence of --internal #2174

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

asg017
Copy link
Contributor

@asg017 asg017 commented Sep 6, 2023

#refs 2157, specifically this comment

Passing in --internal my_internal.db over and over again can get repetitive.

This PR adds a new configurable env variable DATASETTE_INTERNAL_DB_PATH. If it's defined, then it takes place as the path to the internal database. Users can still overwrite this behavior by passing in their own --internal internal.db flag.

In draft mode for now, needs tests and documentation.

Side note: Maybe we can have a sections in the docs that lists all the "configuration environment variables" that Datasette respects? I did a quick grep and found:

  • DATASETTE_LOAD_PLUGINS
  • DATASETTE_SECRETS

📚 Documentation preview 📚: https://datasette--2174.org.readthedocs.build/en/2174/

@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (05707aa) 92.68% compared to head (d75b519) 92.68%.
Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2174   +/-   ##
=======================================
  Coverage   92.68%   92.68%           
=======================================
  Files          40       40           
  Lines        6012     6017    +5     
=======================================
+ Hits         5572     5577    +5     
  Misses        440      440           
Files Changed Coverage Δ
datasette/cli.py 82.53% <ø> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

@simonw
Copy link
Owner

simonw commented Sep 6, 2023

We can use this here: https://click.palletsprojects.com/en/8.1.x/options/#values-from-environment-variables

@click.option(..., envvar="DATASETTE_INTERNAL")

@simonw
Copy link
Owner

simonw commented Sep 6, 2023

DATASETTE_INTERNAL would be more consistent with DATASETTE_SECRET.

@asg017 asg017 changed the title Use $DATASETTE_INTERNAL_DB_PATH in absence of --internal Use $DATASETTE_INTERNAL in absence of --internal Sep 8, 2023
@asg017 asg017 marked this pull request as ready for review September 8, 2023 00:01
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

Successfully merging this pull request may close these issues.

None yet

2 participants