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 environment variables for superuser credentials #22

Open
2 tasks
pawcoding opened this issue Jan 4, 2025 · 0 comments
Open
2 tasks

Use environment variables for superuser credentials #22

pawcoding opened this issue Jan 4, 2025 · 0 comments
Labels
priority/medium [internal] This is not a priority right now but will be done eventually team/for-starters [internal] This can be done by someone external who wants to start contributing type/feature New feature or request

Comments

@pawcoding
Copy link
Owner

pawcoding commented Jan 4, 2025

Use case

To improve security and flexibility, we should avoid hardcoding superuser credentials into the Astro config that is committed to repositories. Instead, it would be better to use credentials provided via a .env file.

Currently, you can already achieve this by importing credentials from Astro's environment variable API and passing them into the loader (as described in #17).

To simplify this process, we could define some environment variables globally instead of requiring them to be passed to each loader instance.

Advantages

  1. Define the variables once globally instead of passing them to every collection separately.
  2. The same variables can also be used in Use environment variables for superuser credentials astro-integration-pocketbase#4.

Requirements

  • Use ALP_SUPERUSER_EMAIL and ALP_SUPERUSER_PASSWORD instead of config.superuserCredentials.x.
  • Use ALP_SERVER_URL instead of config.url.

Not sure about the naming of these yet.

This change can be non-breaking if we keep the current configuration options as a fallback when no environment variables are defined.

  • Environment variables will serve as the base configuration.
  • Configuration options will take precedence, allowing developers to override the environment variables if needed (e.g., when using multiple PocketBase instances).

Bonus:
If possible, make the environment variables used by the loader type-safe.

@pawcoding pawcoding added type/feature New feature or request team/for-starters [internal] This can be done by someone external who wants to start contributing priority/medium [internal] This is not a priority right now but will be done eventually labels Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/medium [internal] This is not a priority right now but will be done eventually team/for-starters [internal] This can be done by someone external who wants to start contributing type/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant