just need to add creating services, deploying them, and showing logs

This commit is contained in:
benbot 2023-10-25 05:41:01 -04:00
parent a3a4af7965
commit 023ad47ae4
6 changed files with 99 additions and 29 deletions

View file

@ -0,0 +1,26 @@
defmodule EzcontainerRailwayWeb.RailwayCheck do
alias EzcontainerRailway.Projects
alias EzcontainerRailway.Railway
alias Phoenix.Controller
import Plug.Conn
def init(default), do: default
def call(conn, _opts) do
case get_session(conn, :railway_token) do
nil ->
conn
|> Controller.put_flash(:error, "You need a railway token")
|> Controller.redirect(to: "/")
token ->
p =
case Projects.get_project_by_token(token) do
nil -> Projects.create_project(token)
p -> p
end
conn
|> put_session(:project_id, p)
end
end
end