zachfeldman / rubypress

Ruby interface for the WordPress XMLRPC API. Follows standard XML-RPC Documentation closely.
201 stars 55 forks source link

Can not read .env #62

Closed baohung02 closed 5 years ago

baohung02 commented 5 years ago

Hi all, I have problem when set up sensitive data to .env file. I got error below:

/usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/net/http.rb:906:in rescue in block in connect': Failed to open TCP connection to localhost:80 (Connection refused - connect(2) for "localhost" port 80) (Errno::ECONNREFUSED) from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/net/http.rb:903:inblock in connect' from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/timeout.rb:93:in block in timeout' from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/timeout.rb:103:intimeout' from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/net/http.rb:902:in connect' from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/net/http.rb:887:indo_start' from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/net/http.rb:882:in start' from /usr/local/lib/ruby/gems/2.4.0/gems/xmlrpc-0.3.0/lib/xmlrpc/client.rb:495:indo_rpc' from /usr/local/lib/ruby/gems/2.4.0/gems/xmlrpc-0.3.0/lib/xmlrpc/client.rb:287:in call2' from /usr/local/lib/ruby/gems/2.4.0/gems/xmlrpc-0.3.0/lib/xmlrpc/client.rb:268:incall' from /usr/local/lib/ruby/gems/2.4.0/gems/rubypress-1.2.2/lib/rubypress/client.rb:70:in execute' from /usr/local/lib/ruby/gems/2.4.0/gems/rubypress-1.2.2/lib/rubypress/posts.rb:29:innewPost' from getChapter.rb:20:in postToDB' from getChapter.rb:40:in

'

screen shot 2018-12-31 at 3 33 59 pm screen shot 2018-12-31 at 3 37 21 pm

zachfeldman commented 5 years ago

@baohung02 this doesn't look like an issue with Rubypress, it looks like you're trying to access a wordpress install at localhost:80 and it doesn't exist.

baohung02 commented 5 years ago

@zachfeldman you can see, I config in .env file default value, then error should be default value, not localhost. I put .env in same directory with getChapter.rb, but could not load. any idea?

zachfeldman commented 5 years ago

@baohung02 the README only says .env can be used in testing, not when making, "real" requests. You may need to fork the gem and make a PR to allow .env to be used.

baohung02 commented 5 years ago

@zachfeldman tks for explaination. Have a nice day