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

added the config system #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

added the config system #26

wants to merge 2 commits into from

Conversation

hl1
Copy link
Contributor

@hl1 hl1 commented May 31, 2020

config.yml has full control of all application variables.

specifying allows python.py to replace it with python code using the class method replace_dynamic()

I have also enabled a way to reference other configurations by putting them in between <>

[EDIT]

Everything that I said above is invalid. I have converted the code to use yaml tags
https://stackoverflow.com/questions/43058050/creating-custom-tag-in-pyyaml

@hl1 hl1 requested review from finish06 and yevgenybulochnik May 31, 2020 23:05
@finish06
Copy link
Member

finish06 commented Jun 2, 2020

@hl1 - Currently, the code does not use any of these variables. This is the first step, where you have created a script to capture the YAML information. Correct?

Also, please be sure to update the requirements with YAML and specify the latest version number.

c.add('app_dir', c.get('base_dir') / 'app')
c.add('data_dir', c.get('app_dir') / 'data')
c.add('log_dir', c.get('app_dir') / 'log')
c.add('json_file_name',os.path.basename(max(glob.glob(str(c.get('data_dir')) + '/*.json'), key=os.path.getctime)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a drugs-ndc.json in the data folder however the following error occurs:

File "app/utils/config.py", line 45, in yaml_construct
    c.add('json_file_name',os.path.basename(max(glob.glob(str(c.get('data_dir')) + '/*.json'), key=os.path.getctime)))
ValueError: max() arg is an empty sequence```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hl1 - Currently, the code does not use any of these variables. This is the first step, where you have created a script to capture the YAML information. Correct?

Also, please be sure to update the requirements with YAML and specify the latest version number.

Correct. this is an independent system that could be added to master without impacting anything. integration is coming.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a drugs-ndc.json in the data folder however the following error occurs:

File "app/utils/config.py", line 45, in yaml_construct
    c.add('json_file_name',os.path.basename(max(glob.glob(str(c.get('data_dir')) + '/*.json'), key=os.path.getctime)))
ValueError: max() arg is an empty sequence```

hmmm... is the data folder in /app/data or /data?

Copy link
Member

@yevgenybulochnik yevgenybulochnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to approve this for now and we will need to make changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants