Skip to content

Commit

Permalink
Merge pull request #1 from Gravitalia/dev
Browse files Browse the repository at this point in the history
Update name
  • Loading branch information
RealHinome committed Jun 17, 2023
2 parents d602737 + d675372 commit 2233cc9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ RUN mix do deps.get, deps.compile

COPY . .

ENV MIX_ENV=prod
RUN mix release

FROM alpine:3.18 AS app

COPY --from=build /app/_build/prod/rel/iris ./

ENV MIX_ENV=prod

EXPOSE 4000

CMD ["bin/iris", "start"]
10 changes: 5 additions & 5 deletions lib/gravitalia.ex
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
defmodule Gravitalia do
defmodule Iris do
use Application

def start(_type, _args) do
children = [
Plug.Cowboy.child_spec(
scheme: :http,
plug: Gravitalia.Router,
plug: Iris.Router,
options: [
dispatch: dispatch(),
port: 4000
]
),
Registry.child_spec(
keys: :duplicate,
name: Registry.Gravitalia
name: Registry.Iris
)
]

opts = [strategy: :one_for_one, name: Gravitalia.Application]
opts = [strategy: :one_for_one, name: Iris.Application]
Supervisor.start_link(children, opts)
end

defp dispatch do
[
{:_,
[
{"/", Gravitalia.SocketHandler, []}
{"/", Iris.SocketHandler, []}
]
}
]
Expand Down
4 changes: 2 additions & 2 deletions lib/router.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule Gravitalia.Router do
defmodule Iris.Router do
use Plug.Router
require EEx

plug Plug.Static,
at: "/",
from: :gravitalia
from: :iris
plug :match
plug Plug.Parsers,
parsers: [:json],
Expand Down
4 changes: 2 additions & 2 deletions lib/socket_handler.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Gravitalia.SocketHandler do
defmodule Iris.SocketHandler do
@behaviour :cowboy_websocket

def init(request, _state) do
Expand All @@ -9,7 +9,7 @@ defmodule Gravitalia.SocketHandler do
end

def websocket_init(state) do
Registry.Gravitalia
Registry.Iris
|> Registry.register(state.registry_key, {})

{:ok, state}
Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defmodule Gravitalia.MixProject do
defmodule Iris.MixProject do
use Mix.Project

def project do
[
app: :gravitalia,
app: :iris,
version: "0.1.0",
elixir: "~> 1.14",
start_permanent: true,
Expand All @@ -14,7 +14,7 @@ defmodule Gravitalia.MixProject do
# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {Gravitalia, []},
mod: {Iris, []},
extra_applications: [:logger]
]
end
Expand Down

0 comments on commit 2233cc9

Please sign in to comment.