mirror of
				https://github.com/livebook-dev/livebook.git
				synced 2025-10-31 15:56:05 +08:00 
			
		
		
		
	* Make it possible to configure custom plug for all requests * Apply review comments * Use fetch_env!
		
			
				
	
	
		
			18 lines
		
	
	
	
		
			343 B
		
	
	
	
		
			Elixir
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
	
		
			343 B
		
	
	
	
		
			Elixir
		
	
	
	
	
	
| defmodule LivebookWeb.ConfiguredPlug do
 | |
|   @moduledoc false
 | |
| 
 | |
|   # Runs plugs configured for the :livebook application
 | |
| 
 | |
|   @behaviour Plug
 | |
| 
 | |
|   @impl true
 | |
|   def init(opts), do: opts
 | |
| 
 | |
|   @impl true
 | |
|   def call(conn, _opts) do
 | |
|     case Application.fetch_env!(:livebook, :plugs) do
 | |
|       [] -> conn
 | |
|       plugs -> Plug.run(conn, plugs)
 | |
|     end
 | |
|   end
 | |
| end
 |