File tree Expand file tree Collapse file tree 6 files changed +46
-0
lines changed
Expand file tree Collapse file tree 6 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ source "https://rubygems.org"
55# Specify your gem's dependencies in ruby-nginx.gemspec
66gemspec
77
8+ gem "debug"
89gem "puma"
910gem "rack"
1011gem "rake"
Original file line number Diff line number Diff line change 1111 specs:
1212 ast (2.4.2 )
1313 cgi (0.4.1 )
14+ date (3.4.1 )
15+ debug (1.10.0 )
16+ irb (~> 1.10 )
17+ reline (>= 0.3.8 )
1418 diff-lcs (1.5.1 )
1519 erb (4.0.4 )
1620 cgi (>= 0.3.3 )
21+ io-console (0.8.0 )
22+ irb (1.15.1 )
23+ pp (>= 0.6.0 )
24+ rdoc (>= 4.0.0 )
25+ reline (>= 0.4.2 )
1726 json (2.10.1 )
1827 language_server-protocol (3.17.0.4 )
1928 lint_roller (1.1.0 )
2433 racc
2534 pastel (0.8.0 )
2635 tty-color (~> 0.5 )
36+ pp (0.6.2 )
37+ prettyprint
38+ prettyprint (0.2.0 )
39+ psych (5.2.3 )
40+ date
41+ stringio
2742 puma (6.6.0 )
2843 nio4r (~> 2.0 )
2944 racc (1.8.1 )
3045 rack (3.1.9 )
3146 rainbow (3.1.1 )
3247 rake (13.2.1 )
48+ rdoc (6.12.0 )
49+ psych (>= 4.0.0 )
3350 regexp_parser (2.10.0 )
51+ reline (0.6.0 )
52+ io-console (~> 0.5 )
3453 rspec (3.13.0 )
3554 rspec-core (~> 3.13.0 )
3655 rspec-expectations (~> 3.13.0 )
7291 standard-performance (1.6.0 )
7392 lint_roller (~> 1.1 )
7493 rubocop-performance (~> 1.23.0 )
94+ stringio (3.1.5 )
7595 thor (1.3.2 )
7696 tty-color (0.6.0 )
7797 tty-command (0.10.1 )
@@ -89,6 +109,7 @@ PLATFORMS
89109 x86_64-linux
90110
91111DEPENDENCIES
112+ debug
92113 puma
93114 rack
94115 rake
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ def generate!
3333 validate!
3434 apply_dynamic_defaults!
3535
36+ create_temp_path!
3637 create_ssl_certs! if options [ :ssl ]
3738 create_log_files! if options [ :log ]
3839
@@ -51,6 +52,7 @@ def defaults
5152
5253 def default_paths
5354 {
55+ temp_path : default_path ( "tmp" ) ,
5456 ssl_certificate_path : default_path ( "certs/_#{ options [ :domain ] } .pem" ) ,
5557 ssl_certificate_key_path : default_path ( "certs/_#{ options [ :domain ] } -key.pem" ) ,
5658 access_log_path : default_path ( "logs/#{ options [ :domain ] } .access.log" ) ,
@@ -92,6 +94,10 @@ def load_template
9294 raise Ruby ::Nginx ::AbortError , "Failed to read template." , cause : e
9395 end
9496
97+ def create_temp_path!
98+ options [ :temp_path ] = System ::SafeFile . mkdir ( options [ :temp_path ] )
99+ end
100+
95101 def create_ssl_certs!
96102 System ::Mkcert . create! (
97103 options [ :domain ] ,
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ module Nginx
77 module System
88 class SafeFile
99 class << self
10+ def mkdir ( dir_path )
11+ safe_path = File . expand_path ( dir_path )
12+
13+ FileUtils . mkdir_p ( dir_path )
14+
15+ safe_path
16+ end
17+
1018 def touch ( file_path )
1119 safe_path = File . expand_path ( file_path )
1220
Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ server {
5454 error_log <%= options[:error_log_path] %> warn;
5555 <% end %>
5656
57+ # Do not use the default proxy_temp_path, this is to avoid directory permissions issues.
58+ proxy_temp_path <%= options[:temp_path] %> 1 2;
59+
5760 # reverse proxy
5861 location @<%= name %> {
5962 proxy_pass http://<%= name %> ;
Original file line number Diff line number Diff line change 2828 end
2929 end
3030
31+ it "creates the NGINX temp path" do
32+ retry_expectation ( limit : 30 , delay : 1 ) do
33+ path = File . expand_path ( "~/.ruby-nginx/tmp" )
34+ expect ( Dir . exist? ( path ) ) . to be_truthy
35+ end
36+ end
37+
3138 it "creates the SSL certificate" do
3239 retry_expectation ( limit : 30 , delay : 1 ) do
3340 path = File . expand_path ( "~/.ruby-nginx/certs/_example.test.pem" )
You can’t perform that action at this time.
0 commit comments