File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 10
10
else
11
11
system ( "node node-server/server-dev.js --ruby-port=#{ rubyPort } --node-port=9293 &" )
12
12
end
13
- elsif ENV [ 'SP ' ] == 'true'
14
- workers 1
13
+ elsif ENV [ 'WP ' ] != nil
14
+ workers ENV [ 'WP' ] . to_i
15
15
before_fork do
16
- puts "Single Process Mode " . colorize ( :red )
16
+ puts "The amount of proccesses is: #{ ENV [ 'WP' ] } " . colorize ( :green )
17
17
puts "Master Process ID: #{ Process . pid } " . colorize ( :green )
18
18
puts "Starting Server..." . colorize ( :green )
19
19
rubyPort = 9292
Original file line number Diff line number Diff line change 26
26
}
27
27
#Validate the YML file
28
28
validateYML ( )
29
+ #Validate the ENV variables
30
+ validateEnv ( )
29
31
#Encrypted cookies
30
32
use Rack ::Session ::EncryptedCookie , cookie_options
31
33
#csrf
38
40
if request . path_info == '/auth'
39
41
return
40
42
#any route on the main domain
41
- elsif request . url . include? Settings . mainURL
43
+ elsif request . url . include? ENV [ 'DOMAIN' ] || Settings . mainURL
42
44
return
43
45
else
44
46
auth ( )
Original file line number Diff line number Diff line change 13
13
require './ruby/utils.rb'
14
14
require './ruby/uv.rb'
15
15
require './ruby/auth.rb'
16
- require './ruby/yamlValidator .rb'
16
+ require './ruby/validator .rb'
Original file line number Diff line number Diff line change @@ -52,3 +52,15 @@ def validateYML
52
52
exit
53
53
end
54
54
end
55
+
56
+ def validateEnv
57
+ if ENV [ 'DOMAIN' ] != nil
58
+ if ENV [ 'DOMAIN' ] !~ /\A #{ URI ::regexp ( [ 'http' , 'https' ] ) } \z /
59
+ puts "Domain is not a valid URL" . red
60
+ exit
61
+ elsif ENV [ 'DOMAIN' ] !~ /\/ \z /
62
+ puts "Domain must end with a /" . red
63
+ exit
64
+ end
65
+ end
66
+ end
You can’t perform that action at this time.
0 commit comments