-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Hotfix detecting robyn.env #292
Conversation
✅ Deploy Preview for robyn canceled.
|
Hey @Shending-Help , Thanks for the PR. 😄 I have a suggestion regarding the implementation approach. We should only be detecting Something similar to: Also, the CI is failing for some reason. |
@sansyrox I made it so the root of the project gets passed to the load_vars() function and pass it the directory at which Robyn gets initialized |
robyn/env_populator.py
Outdated
"""Find robyn.env file in root of the project""" | ||
if config_path is None: | ||
config_path = Path(project_root) / "robyn.env" | ||
|
||
"""Parse the configuration file""" |
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.
@Shending-Help , this should be the docstring of the function as this is the main purpose.
You can make the comment below as a #
comment.
"""Find robyn.env file in root of the project"""
Docstrings are reflected in the function metadata and it doesn't make a lot of sense to add two of them.
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.
@sansyrox fixed it
robyn/env_populator.py
Outdated
@@ -26,11 +24,11 @@ def parser(config_path=CONFIG_PATH): | |||
|
|||
|
|||
# check for the environment variables set in cli and if not set them | |||
def load_vars(variables = None): | |||
def load_vars(variables = None, root = None): |
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.
Two last nits: let's call the variable as project_root
only as we want the **kwargs
to be related to the function name,
Second, can you please use the pre-commit
hooks like mentioned in here https://github.com/sansyrox/robyn#%EF%B8%8F-to-develop-locally
Thanks again 😄
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.
@sansyrox done
…ironment variables automatically
* fix(dev_event_handler.py): use platform specific python3 alias to spawn processes
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.
LGTM! Great work @Shending-Help 🔥
Description
This PR fixes an issue with detecting robyn.env in a project, if the server is started somewhere in a nested file or the user placed robyn.env somewhere different than expected of him robyn.env won't be found and thus i added a file detector function that starts searching from an entry point where robyn server started and goes from the bottom up in the directories searching for robyn.env