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
Custom path to DB connection Details ignored #641
Comments
To solve this you should normally redefine the DB_CONFIG_PATH=config/core/database |
Yea this is the solution 👆 @girardinsamuel is this not documented? I don't see it in the install part of Masonite orm |
This is fine if your using .env files which I am not. To clarify I am building a webapp in the cloud (AWS Lambda) This is obviously not desirable for sensite items like passwords and external api keys (eg Stripe) In my case the config files all pull their item info from AWS Parameter Store (SSM) and so is only available to the code at runtime. my desired config folder structure looks like this: config
The config gets loaded in the following order and each layer has the ability to override the setting if set previously.
This creates a hierarchy that is obvious IMHO and very modular. If i have to have the database.py on its own (ie not with the other "core" modules, this breaks the Masonite configuration loader in a really bad way as well as being confusing to other developers about the reason for file placement outside of its scope of use (being the folder its in). So back to my original point with the config path. The custom path is used in some classes eg ShellCommand and Migration so why not in the core of the ORM? I hope this clarifies things for you. PS my PR #642 is not passing tests (not sure why) but you can see the additions I have made so far to demonstrate what I am explaining here. |
@girardinsamuel do you think we can optionally load the module in directly somehow instead of pointing a string to the module location? That would allow us to be have more flexibility over how it loads in then |
I am not sure I understand what you mean 🤔 |
@girardinsamuel @josephmancuso That said this is still an issue that should still be addressed at some stage, though imm not sure how to fully do that. |
Describe the bug
Using custom connection details providing a non default path to database config file are ignored.
To Reproduce
i ran into this while playing with a custom Masonite config
But this will also be the case if others use a non standard location for their config
Steps to reproduce the behavior:
self.application.bind("config.location", "config")
to
self.application.bind("config.location", "config.core")
masoniteorm.exceptions.ConfigurationNotFound: ORM configuration file has not been found in config.database.
Expected behavior
the custom config path should be used to load the config file
Screenshots or code snippets
N/A
Desktop (please complete the following information):
What database are you using?
Additional context
N/A
The text was updated successfully, but these errors were encountered: