feat: add options loading from .ini file #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Create a loader that reuses the existing format from the python SDK.
It's loading the options from the
~/.anki_vector/sdk_config.ini
path.To ensure it will work well for Linux, macOS, and Windows, the loader uses
os.UserHomeDir()
to get the user home directory andfilepath.Join
to create a compatible file path.Linked Issues
Write a configuration loader that reuses the existing format from the python sdk #1
Notes
This code is not actually supporting 100% of the existing
.ini
format (for python SDK). It's only loading the information from theDEFAULT
section, and mapping to a struct, like:The code for getting the section is:
A suggestion to handle this is to add a "profile" that targets the wanted section, similar to AWS profiles in the CLI, and pass it as a parameter in
vector.New()
or something like this. So we could do something like:And then it wil load the information about the another bot.
Additionally
What do you think about add logging to the SDK? There are some blank identifiers ("_") for errors that should not crash the function, but it might be a good idea to display them.
Thoughts? @dietb @bussardrobbie