added bind for sinatra

This commit is contained in:
Joseph.Roy 2023-12-18 14:34:22 +00:00
parent e6e0fc40cb
commit 2c87584d2d
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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