Skip to content

Commit 8474698

Browse files
Optional values are now actually optional
1 parent 2cf7d40 commit 8474698

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

cli/cli.rb

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
require_relative '../ruby/db.rb'
88

99
settings = YAML.load_file(File.join(File.dirname(__FILE__), '../config/settings.yml'))
10-
$host = ENV['DB_HOST'] || settings['database']['host'].to_s
11-
$user = ENV['DB_USERNAME'] || settings['database']['username'].to_s
12-
$password = ENV['DB_PASSWORD'] || settings['database']['password'].to_s
13-
$database = ENV['DB_DATABASE'] || settings['database']['dbname'].to_s
10+
$host = settings['database']['host'].to_s if settings['database']
11+
$user = settings['database']['username'].to_s if settings['database']
12+
$password = settings['database']['password'].to_s if settings['database']
13+
$database = settings['database']['dbname'].to_s if settings['database']
14+
$host = ENV['DB_HOST'] if ENV['DB_HOST']
15+
$user = ENV['DB_USER'] if ENV['DB_USER']
16+
$password = ENV['DB_PASS'] if ENV['DB_PASS']
17+
$database = ENV['DB_NAME'] if ENV['DB_NAME']
1418

1519
class RubyCLI < Thor
1620
desc "start", "Start the server"

docker/docker-compose.build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
image: ruby:latest
55
build:
66
context: .
7-
target: normal
7+
target: node
88
container_name: ruby
99
restart: unless-stopped
1010
ports:

docker/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3'
22
services:
33
ruby:
44
restart: unless-stopped
5-
image: 'motortruck1221/ruby:latest'
5+
image: 'motortruck1221/ruby-node:latest'
66
ports:
77
#DO NOT CHANGE 9294!
88
- your port here:9294

ruby/auth.rb

+9-7
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ def call(env)
1313
# session[:auth] = true
1414
# session[:uid] = SecureRandom.alphanumeric(2048)
1515
# return [302, {'Location' => '/'}, []]
16-
if Settings.corlink.enabled == "true" && Settings.private == "false"
17-
auth = params['unlock']
18-
req = HTTParty.post("#{Settings.corlink.url}", headers: { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{Settings.corlink.apiKey}", 'Key' => "#{auth}" })
19-
if req.code == 200
20-
session[:auth] = true
21-
session[:uid] = SecureRandom.alphanumeric(2048)
22-
return [302, {'Location' => '/'}, []]
16+
if Settings.corlink != nil
17+
if Settings.corlink.enabled == "true" && Settings.private == "false"
18+
auth = params['unlock']
19+
req = HTTParty.post("#{Settings.corlink.url}", headers: { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{Settings.corlink.apiKey}", 'Key' => "#{auth}" })
20+
if req.code == 200
21+
session[:auth] = true
22+
session[:uid] = SecureRandom.alphanumeric(2048)
23+
return [302, {'Location' => '/'}, []]
24+
end
2325
end
2426
else
2527
if Settings.private == "false" && params['unlock'] == '' || params['unlock'] == 'unlock' || params['unlock'] == 'true' || params['unlock'] == ' '

0 commit comments

Comments
 (0)