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
First Pass of API-side NervesHub integration #998
Conversation
This is the all the code for the remote api calls FarmBot API will need to make to NervesHub for generating devices. No public access to this yet.
This stops http requests from blocking
This prevents path traversal attacks probably
…eb-App into nerves-hub-pt1
…into nerves-hub-pt1
…ot-Web-App into nerves-hub-pt1
Codecov Report
@@ Coverage Diff @@
## staging #998 +/- ##
===========================================
+ Coverage 95.22% 99.92% +4.69%
===========================================
Files 216 226 +10
Lines 4354 3796 -558
===========================================
- Hits 4146 3793 -353
+ Misses 208 3 -205
Continue to review full report at Codecov.
|
app/lib/nerves_hub.rb
Outdated
end | ||
|
||
# Private Key for authenticating Farmbot API (NOT FARMBOT OS) to NervesHub | ||
def self.try_env_ca_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.
I got this method, comment and the following method wrong. Sorry.
It should be self.try_file_ca_file
and the next method should be self.try_env_ca_file
The comment should also say something like `CA file for authenticating Farmbot API (NOT FARMBOT OS) to NervsHub
app/lib/nerves_hub.rb
Outdated
# Allow loading this as a normal cert, it only allows | ||
# loading a flie from the filesystem. | ||
# https://stackoverflow.com/questions/36993208/how-to-enumerate-through-multiple-certificates-in-a-bundle | ||
def self.try_file_ca_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.
This one should be self.try_env_ca_file
app/lib/nerves_hub.rb
Outdated
# loading a flie from the filesystem. | ||
# https://stackoverflow.com/questions/36993208/how-to-enumerate-through-multiple-certificates-in-a-bundle | ||
def self.try_file_ca_file | ||
if ENV['NERVES_HUB_KEY'] |
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.
this should be ENV['NERVES_HUB_CA']
app/lib/nerves_hub.rb
Outdated
def self.try_file_ca_file | ||
if ENV['NERVES_HUB_KEY'] | ||
file = File.open(NERVES_HUB_CA_HACK, 'w') | ||
file.write(ENV['NERVES_HUB_KEY']) |
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.
this should be ENV['NERVES_HUB_CA']
No description provided.