Spaces:
Build error
Build error
hiett commited on
Commit ·
f085bb2
1
Parent(s): 7edc4a0
SSL support
Browse filesFiles changed (4)
25 unmodified lines2627282930313225 unmodified linesendmatch _ dohandle_response({:not_found, "SRH: Endpoint not found. SRH might not support this feature yet."}, conn)enddefp do_command_request(conn, success_lambda) do25 unmodified lines2627282930313233343525 unmodified linesendmatch _ dohandle_response({:not_found, "SRH: Endpoint not found. SRH might not support this feature yet."},conn)enddefp do_command_request(conn, success_lambda) do
34 unmodified lines3536373839404134 unmodified lines# Return a custom error, ensuring the same format as the other errorsconn|> put_resp_content_type("application/json")|> send_resp(400, Jason.encode!(%{error: "Invalid content type. Expected application/json."}))|> halt()endend34 unmodified lines3536373839404142434434 unmodified lines# Return a custom error, ensuring the same format as the other errorsconn|> put_resp_content_type("application/json")|> send_resp(400,Jason.encode!(%{error: "Invalid content type. Expected application/json."}))|> halt()endend
2 unmodified lines34567892 unmodified linesalias Srh.Redis.ClientRegistryalias Srh.Redis.ClientWorker@idle_death_time 1000 * 15def start_link(max_connections, connection_info) doGenServer.start_link(__MODULE__, {max_connections, connection_info}, [])2 unmodified lines34567892 unmodified linesalias Srh.Redis.ClientRegistryalias Srh.Redis.ClientWorker@idle_death_time 1000 * 60 * 15 # 15 minutesdef start_link(max_connections, connection_info) doGenServer.start_link(__MODULE__, {max_connections, connection_info}, [])
61 unmodified lines62636465666768697061 unmodified lines} = state)when is_binary(connection_string) do# NOTE: Redix only seems to open the connection when the first command is sent# This means that this will return :ok even if the connection string may not actually be connectable{:ok, pid} = Redix.start_link(connection_string){:noreply, %{state | redix_pid: pid}}end61 unmodified lines626364656667686970717273747576777879808182838485868788899061 unmodified lines} = state)when is_binary(connection_string) doenable_ssl = String.starts_with?(connection_string, "rediss://")socket_opts =case enable_ssl dotrue ->[customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]]false ->[]end# NOTE: Redix only seems to open the connection when the first command is sent# This means that this will return :ok even if the connection string may not actually be connectable{:ok, pid} =Redix.start_link(connection_string,ssl: enable_ssl,socket_opts: socket_opts){:noreply, %{state | redix_pid: pid}}end
lib/srh/http/base_router.ex+4-1
lib/srh/http/content_type_check_plug.ex+4-1
lib/srh/redis/client.ex+1-1
lib/srh/redis/client_worker.ex+21-1