-
Notifications
You must be signed in to change notification settings - Fork 5
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
[FIX] DockerTestConfig #15
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15 +/- ##
==========================================
- Coverage 63.50% 63.31% -0.19%
==========================================
Files 22 22
Lines 685 687 +2
==========================================
Hits 435 435
- Misses 250 252 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The password is already pulled from the env variables in the main config, so you should just be able to change the db_name and re-set the URI to use the new variables
update DB_NAME and SQLALCHEMY_DATABASE_URI variables for DockerTestConfig Co-authored-by: Alejandro de la Vega <aleph4@gmail.com>
oh crap, i guess the variable is not available. well then shoot lets revert that |
yeah actually instead just add these thre lines to the
|
Can we make an __init__ function for the class and assign these variables to self? Would that fix the issue of reassignment? |
yes that would be another option. you could set |
neurostuff/example_config.py
Outdated
|
||
|
||
class ProductionConfig(Config): | ||
ENV = 'production' | ||
def __init__(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'm being super pedantic now so I apologize, but I think we can get away with only the self.SQLALCHEMY_DATABASE_URI variable being in the __init__
function on top, since all others are just plain variables.
Especially for these derivative classes, let's keep them simple just to simplify future maintenance.
def __init__(self): |
neurostuff/example_config.py
Outdated
|
||
|
||
class ProductionConfig(Config): | ||
ENV = 'production' | ||
def __init__(self): | ||
super().__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super().__init__() |
neurostuff/example_config.py
Outdated
ENV = 'production' | ||
def __init__(self): | ||
super().__init__() | ||
self.ENV = 'production' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.ENV = 'production' | |
ENV = 'production' |
As an example, I think this should work, since the ENV
variable for this derivative class will be set before the __init__
method is called.
That way, no need to mess around with super
.
873c275
to
26cd210
Compare
okay, I went back to my original solution and learned(?) about when variables are instantiated in a class when referencing it as |
Cool LGTM |
fixes #14
This pull request suggests:
POSTGRES_PASSWORD