added bind for sinatra
This commit is contained in:
parent
e6e0fc40cb
commit
2c87584d2d
|
@ -11,6 +11,8 @@ require 'sqlite3'
|
|||
require 'jwt'
|
||||
require 'dotenv/load'
|
||||
|
||||
set :bind, '0.0.0.0'
|
||||
|
||||
TOKEN_SECRET = ENV['JWT_SECRET_KEY']
|
||||
puts TOKEN_SECRET
|
||||
initialize_database
|
||||
|
|
|
@ -78,15 +78,17 @@ uri = URI.parse('https://auth.roysathome.net/upload')
|
|||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl = true
|
||||
|
||||
puts 'Enter message to send:'
|
||||
message = gets
|
||||
request = Net::HTTP::Post::Multipart.new(
|
||||
uri.path,
|
||||
'file' => UploadIO.new(StringIO.new(file_content), 'application/octet-stream', 'example.txt')
|
||||
'file' => UploadIO.new(StringIO.new(message), 'application/octet-stream', 'example.txt')
|
||||
)
|
||||
|
||||
request['Authorization'] = "Bearer #{authentication_token}"
|
||||
|
||||
# Send the request
|
||||
puts "Sending file of size #{(File.size('./example.txt') / 2**20).round(2)} MB"
|
||||
#puts "Sending file of size #{(File.size('./example.txt') / 2**20).round(2)} MB"
|
||||
response = http.request(request)
|
||||
|
||||
#puts response.code
|
||||
|
|
Loading…
Reference in New Issue