-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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
- Define the variables once globally instead of passing them to every collection separately.
- The same variables can also be used in Use environment variables for superuser credentials astro-integration-pocketbase#4.
Requirements
- Use
ALP_SUPERUSER_EMAILandALP_SUPERUSER_PASSWORDinstead ofconfig.superuserCredentials.x. - Use
ALP_SERVER_URLinstead ofconfig.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.