Skip to content

Instantly share code, notes, and snippets.

View alvarolizama's full-sized avatar
🤖
Working at Resuelve

Alvaro Lizama alvarolizama

🤖
Working at Resuelve
View GitHub Profile
@alvarolizama
alvarolizama / application.ex
Created October 11, 2020 01:49 — forked from gvaughn/application.ex
Cowboy 2.5 proxy, used to bind a single port (on Heroku) for umbrella Phoenix applications. It supports HTTPS and websockets properly.
defmodule MasterProxy.Application do
alias MyApp.Endpoint, as: MyAppEndpoint
alias MyApp.UserSocket, as: MyAppUserSocket
alias MyOtherApp.Endpoint, as: MyOtherAppEndpoint
alias MyOtherApp.UserSocket, as: MyOtherAppUserSocket
alias Phoenix.LiveReloader.Socket, as: LiveReloadSocket
alias Plug.Cowboy
@alvarolizama
alvarolizama / gce_auth.ex
Created July 10, 2019 04:03 — forked from plamb/gce_auth.ex
Authenticate with Google Cloud using service account json key and Elixir
# https://developers.google.com/identity/protocols/OAuth2ServiceAccount
key_json = File.read!("some-service-account-key-file.json")
key_map = JOSE.decode(key_json)
jwk = JOSE.JWK.from_pem(key_map["private_key"])
jws = %{"alg" => "RS256"}
header = %{