mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Check for KEMAL_ENV variable already in Config#initialize (#552)
This commit is contained in:
		
							parent
							
								
									15022c25b8
								
							
						
					
					
						commit
						740cb188a9
					
				
					 2 changed files with 10 additions and 17 deletions
				
			
		|  | @ -8,7 +8,6 @@ module Kemal | ||||||
|       @key_file = "" |       @key_file = "" | ||||||
|       @cert_file = "" |       @cert_file = "" | ||||||
|       @config = Kemal.config |       @config = Kemal.config | ||||||
|       read_env |  | ||||||
|       if args |       if args | ||||||
|         parse args |         parse args | ||||||
|       end |       end | ||||||
|  | @ -42,21 +41,15 @@ module Kemal | ||||||
| 
 | 
 | ||||||
|     private def configure_ssl |     private def configure_ssl | ||||||
|       {% if !flag?(:without_openssl) %} |       {% if !flag?(:without_openssl) %} | ||||||
|       if @ssl_enabled |         if @ssl_enabled | ||||||
|         abort "SSL Key Not Found" if !@key_file |           abort "SSL Key Not Found" if !@key_file | ||||||
|         abort "SSL Certificate Not Found" if !@cert_file |           abort "SSL Certificate Not Found" if !@cert_file | ||||||
|         ssl = Kemal::SSL.new |           ssl = Kemal::SSL.new | ||||||
|         ssl.key_file = @key_file.not_nil! |           ssl.key_file = @key_file.not_nil! | ||||||
|         ssl.cert_file =  @cert_file.not_nil! |           ssl.cert_file = @cert_file.not_nil! | ||||||
|         Kemal.config.ssl = ssl.context |           Kemal.config.ssl = ssl.context | ||||||
|       end |         end | ||||||
|     {% end %} |       {% end %} | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     private def read_env |  | ||||||
|       if kemal_env = ENV["KEMAL_ENV"]? |  | ||||||
|         @config.env = kemal_env |  | ||||||
|       end |  | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ module Kemal | ||||||
|     def initialize |     def initialize | ||||||
|       @host_binding = "0.0.0.0" |       @host_binding = "0.0.0.0" | ||||||
|       @port = 3000 |       @port = 3000 | ||||||
|       @env = "development" |       @env = ENV["KEMAL_ENV"]? || "development" | ||||||
|       @serve_static = {"dir_listing" => false, "gzip" => true} |       @serve_static = {"dir_listing" => false, "gzip" => true} | ||||||
|       @public_folder = "./public" |       @public_folder = "./public" | ||||||
|       @logging = true |       @logging = true | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue