API-only Phoenix 1.8 project for cloud-ops, inventory, billing, and provisioning sagas. Validates arcadia JWTs via shared Guardian secret (verify-only; arcadia-app remains the issuer). Deps beyond default Phoenix: guardian, cors_plug, oban, req. Postgres on local port 5433 per arcadia stack convention. Endpoint runs on :4005. Endpoints: - GET /api/health — public, returns service identifier - GET /api/v1/inventory — auth-gated, returns empty list (phase 0 stub) Oban configured with the queues phase 1+ will need: provisioning / cloud_sync_fast|full|slow / cloud_billing / metering. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
57 lines
1.6 KiB
Elixir
57 lines
1.6 KiB
Elixir
defmodule ArcadiaCloudWeb.Endpoint do
|
|
use Phoenix.Endpoint, otp_app: :arcadia_cloud
|
|
|
|
# The session will be stored in the cookie and signed,
|
|
# this means its contents can be read but not tampered with.
|
|
# Set :encryption_salt if you would also like to encrypt it.
|
|
@session_options [
|
|
store: :cookie,
|
|
key: "_arcadia_cloud_key",
|
|
signing_salt: "Ia2pTcnv",
|
|
same_site: "Lax"
|
|
]
|
|
|
|
# socket "/live", Phoenix.LiveView.Socket,
|
|
# websocket: [connect_info: [session: @session_options]],
|
|
# longpoll: [connect_info: [session: @session_options]]
|
|
|
|
# Serve at "/" the static files from "priv/static" directory.
|
|
#
|
|
# When code reloading is disabled (e.g., in production),
|
|
# the `gzip` option is enabled to serve compressed
|
|
# static files generated by running `phx.digest`.
|
|
plug Plug.Static,
|
|
at: "/",
|
|
from: :arcadia_cloud,
|
|
gzip: not code_reloading?,
|
|
only: ArcadiaCloudWeb.static_paths(),
|
|
raise_on_missing_only: code_reloading?
|
|
|
|
# Code reloading can be explicitly enabled under the
|
|
# :code_reloader configuration of your endpoint.
|
|
if code_reloading? do
|
|
plug Phoenix.CodeReloader
|
|
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :arcadia_cloud
|
|
end
|
|
|
|
plug Plug.RequestId
|
|
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
|
|
|
|
plug Plug.Parsers,
|
|
parsers: [:urlencoded, :multipart, :json],
|
|
pass: ["*/*"],
|
|
json_decoder: Phoenix.json_library()
|
|
|
|
plug Plug.MethodOverride
|
|
plug Plug.Head
|
|
plug Plug.Session, @session_options
|
|
|
|
plug CORSPlug,
|
|
origin: [
|
|
"http://localhost:5173",
|
|
~r{^https://.*\.sky-ai\.com$}
|
|
]
|
|
|
|
plug ArcadiaCloudWeb.Router
|
|
end
|