···11-# StatusphereElixir
11+# Statusphere
2233To start your Phoenix server:
4455-* Run `mix setup` to install and setup dependencies
66-* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
55+- Run `mix setup` to install and setup dependencies
66+- Start Phoenix endpoint with `mix phx.server` or inside IEx with
77+ `iex -S mix phx.server`
7889Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
9101010-Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
1111+Ready to run in production? Please
1212+[check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
11131214## Learn more
13151414-* Official website: https://www.phoenixframework.org/
1515-* Guides: https://hexdocs.pm/phoenix/overview.html
1616-* Docs: https://hexdocs.pm/phoenix
1717-* Forum: https://elixirforum.com/c/phoenix-forum
1818-* Source: https://github.com/phoenixframework/phoenix
1616+- Official website: https://www.phoenixframework.org/
1717+- Guides: https://hexdocs.pm/phoenix/overview.html
1818+- Docs: https://hexdocs.pm/phoenix
1919+- Forum: https://elixirforum.com/c/phoenix-forum
2020+- Source: https://github.com/phoenixframework/phoenix
+5-2
assets/css/app.css
···44@import "tailwindcss" source(none);
55@source "../css";
66@source "../js";
77-@source "../../lib/statusphere_elixir_web";
77+@source "../../lib/statusphere_web";
8899/* A Tailwind plugin that makes "hero-#{ICON}" classes available.
1010 The heroicons installation itself is managed by your mix.exs */
···100100@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
101101102102/* Make LiveView wrapper divs transparent for layout */
103103-[data-phx-session], [data-phx-teleported-src] { display: contents }
103103+[data-phx-session],
104104+[data-phx-teleported-src] {
105105+ display: contents;
106106+}
104107105108/* This file is for your main application CSS */
+47-39
assets/js/app.js
···1818// To load it, simply add a second `<link>` to your `root.html.heex` file.
19192020// Include phoenix_html to handle method=PUT/DELETE in forms and buttons.
2121-import "phoenix_html"
2121+import "phoenix_html";
2222// Establish Phoenix Socket and LiveView configuration.
2323-import {Socket} from "phoenix"
2424-import {LiveSocket} from "phoenix_live_view"
2525-import {hooks as colocatedHooks} from "phoenix-colocated/statusphere_elixir"
2626-import topbar from "../vendor/topbar"
2323+import { Socket } from "phoenix";
2424+import { LiveSocket } from "phoenix_live_view";
2525+import { hooks as colocatedHooks } from "phoenix-colocated/statusphere";
2626+import topbar from "../vendor/topbar";
27272828-const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
2828+const csrfToken = document
2929+ .querySelector("meta[name='csrf-token']")
3030+ .getAttribute("content");
2931const liveSocket = new LiveSocket("/live", Socket, {
3032 longPollFallbackMs: 2500,
3131- params: {_csrf_token: csrfToken},
3232- hooks: {...colocatedHooks},
3333-})
3333+ params: { _csrf_token: csrfToken },
3434+ hooks: { ...colocatedHooks },
3535+});
34363537// Show progress bar on live navigation and form submits
3636-topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
3737-window.addEventListener("phx:page-loading-start", _info => topbar.show(300))
3838-window.addEventListener("phx:page-loading-stop", _info => topbar.hide())
3838+topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" });
3939+window.addEventListener("phx:page-loading-start", (_info) => topbar.show(300));
4040+window.addEventListener("phx:page-loading-stop", (_info) => topbar.hide());
39414042// connect if there are any LiveViews on the page
4141-liveSocket.connect()
4343+liveSocket.connect();
42444345// expose liveSocket on window for web console debug logs and latency simulation:
4446// >> liveSocket.enableDebug()
4547// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
4648// >> liveSocket.disableLatencySim()
4747-window.liveSocket = liveSocket
4949+window.liveSocket = liveSocket;
48504951// The lines below enable quality of life phoenix_live_reload
5052// development features:
···5355// 2. click on elements to jump to their definitions in your code editor
5456//
5557if (process.env.NODE_ENV === "development") {
5656- window.addEventListener("phx:live_reload:attached", ({detail: reloader}) => {
5757- // Enable server log streaming to client.
5858- // Disable with reloader.disableServerLogs()
5959- reloader.enableServerLogs()
5858+ window.addEventListener(
5959+ "phx:live_reload:attached",
6060+ ({ detail: reloader }) => {
6161+ // Enable server log streaming to client.
6262+ // Disable with reloader.disableServerLogs()
6363+ reloader.enableServerLogs();
60646161- // Open configured PLUG_EDITOR at file:line of the clicked element's HEEx component
6262- //
6363- // * click with "c" key pressed to open at caller location
6464- // * click with "d" key pressed to open at function component definition location
6565- let keyDown
6666- window.addEventListener("keydown", e => keyDown = e.key)
6767- window.addEventListener("keyup", _e => keyDown = null)
6868- window.addEventListener("click", e => {
6969- if(keyDown === "c"){
7070- e.preventDefault()
7171- e.stopImmediatePropagation()
7272- reloader.openEditorAtCaller(e.target)
7373- } else if(keyDown === "d"){
7474- e.preventDefault()
7575- e.stopImmediatePropagation()
7676- reloader.openEditorAtDef(e.target)
7777- }
7878- }, true)
6565+ // Open configured PLUG_EDITOR at file:line of the clicked element's HEEx component
6666+ //
6767+ // * click with "c" key pressed to open at caller location
6868+ // * click with "d" key pressed to open at function component definition location
6969+ let keyDown;
7070+ window.addEventListener("keydown", (e) => (keyDown = e.key));
7171+ window.addEventListener("keyup", (_e) => (keyDown = null));
7272+ window.addEventListener(
7373+ "click",
7474+ (e) => {
7575+ if (keyDown === "c") {
7676+ e.preventDefault();
7777+ e.stopImmediatePropagation();
7878+ reloader.openEditorAtCaller(e.target);
7979+ } else if (keyDown === "d") {
8080+ e.preventDefault();
8181+ e.stopImmediatePropagation();
8282+ reloader.openEditorAtDef(e.target);
8383+ }
8484+ },
8585+ true
8686+ );
79878080- window.liveReloader = reloader
8181- })
8888+ window.liveReloader = reloader;
8989+ }
9090+ );
8291}
8383-
+11-7
config/config.exs
···77# General application configuration
88import Config
991010-config :statusphere_elixir,
1111- ecto_repos: [StatusphereElixir.Repo],
1010+config :statusphere,
1111+ ecto_repos: [Statusphere.Repo],
1212 generators: [timestamp_type: :utc_datetime, binary_id: true]
13131414# Configure the endpoint
1515-config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
1515+config :statusphere, StatusphereWeb.Endpoint,
1616 url: [host: "localhost"],
1717 adapter: Bandit.PhoenixAdapter,
1818 render_errors: [
1919- formats: [html: StatusphereElixirWeb.ErrorHTML, json: StatusphereElixirWeb.ErrorJSON],
1919+ formats: [html: StatusphereWeb.ErrorHTML, json: StatusphereWeb.ErrorJSON],
2020 layout: false
2121 ],
2222- pubsub_server: StatusphereElixir.PubSub,
2222+ pubsub_server: Statusphere.PubSub,
2323 live_view: [signing_salt: "t+91lIqk"]
24242525# Configure esbuild (the version is required)
2626config :esbuild,
2727 version: "0.25.4",
2828- statusphere_elixir: [
2828+ statusphere: [
2929 args:
3030 ~w(js/app.js --bundle --target=es2022 --outdir=../priv/static/assets/js --external:/fonts/* --external:/images/* --alias:@=.),
3131 cd: Path.expand("../assets", __DIR__),
···3535# Configure tailwind (the version is required)
3636config :tailwind,
3737 version: "4.1.12",
3838- statusphere_elixir: [
3838+ statusphere: [
3939 args: ~w(
4040 --input=assets/css/app.css
4141 --output=priv/static/assets/css/app.css
···56565757# Use Jason for JSON parsing in Phoenix
5858config :phoenix, :json_library, Jason
5959+6060+config :atex, Atex.OAuth,
6161+ scopes: ["transition:generic"],
6262+ key_id: "statusphere"
59636064# Import environment specific config. This must remain at the bottom
6165# of this file so it overrides the configuration defined above.
+15-9
config/dev.exs
···11import Config
2233# Configure your database
44-config :statusphere_elixir, StatusphereElixir.Repo,
55- database: Path.expand("../statusphere_elixir_dev.db", __DIR__),
44+config :statusphere, Statusphere.Repo,
55+ database: Path.expand("../statusphere_dev.db", __DIR__),
66 pool_size: 5,
77 stacktrace: true,
88 show_sensitive_data_on_connection_error: true
···1313# The watchers configuration can be used to run external
1414# watchers to your application. For example, we can use it
1515# to bundle .js and .css sources.
1616-config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
1616+config :statusphere, StatusphereWeb.Endpoint,
1717 # Binding to loopback ipv4 address prevents access from other machines.
1818 # Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
1919 http: [ip: {127, 0, 0, 1}],
···2222 debug_errors: true,
2323 secret_key_base: "YjHndGQyYIEkOsJtZzle8dUtbznbvM2CwGhF7NSoWxgSTIGpouNbVIND7cAmnWfB",
2424 watchers: [
2525- esbuild: {Esbuild, :install_and_run, [:statusphere_elixir, ~w(--sourcemap=inline --watch)]},
2626- tailwind: {Tailwind, :run, [:statusphere_elixir, ~w(--watch)]}
2525+ esbuild: {Esbuild, :install_and_run, [:statusphere, ~w(--sourcemap=inline --watch)]},
2626+ tailwind: {Tailwind, :run, [:statusphere, ~w(--watch)]}
2727 ]
28282929# ## SSL Support
···5050# different ports.
51515252# Reload browser tabs when matching files change.
5353-config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
5353+config :statusphere, StatusphereWeb.Endpoint,
5454 live_reload: [
5555 web_console_logger: true,
5656 patterns: [
5757 # Static assets, except user uploads
5858 ~r"priv/static/(?!uploads/).*\.(js|css|png|jpeg|jpg|gif|svg)$",
5959 # Router, Controllers, LiveViews and LiveComponents
6060- ~r"lib/statusphere_elixir_web/router\.ex$",
6161- ~r"lib/statusphere_elixir_web/(controllers|live|components)/.*\.(ex|heex)$"
6060+ ~r"lib/statusphere_web/router\.ex$",
6161+ ~r"lib/statusphere_web/(controllers|live|components)/.*\.(ex|heex)$"
6262 ]
6363 ]
64646565# Enable dev routes for dashboard and mailbox
6666-config :statusphere_elixir, dev_routes: true
6666+config :statusphere, dev_routes: true
67676868# Do not include metadata nor timestamps in development logs
6969config :logger, :default_formatter, format: "[$level] $message\n"
···8282 debug_attributes: true,
8383 # Enable helpful, but potentially expensive runtime checks
8484 enable_expensive_runtime_checks: true
8585+8686+config :atex, Atex.OAuth,
8787+ base_url: "http://127.0.0.1:4000/oauth",
8888+ private_key:
8989+ "MHcCAQEEIGA8RFx1QUfvdVPD24SvBMS6a0X9fPYx6EPLHttG55ScoAoGCCqGSM49AwEHoUQDQgAEcGzUFa2vMqnevHI5R+QByCmHSCfVy7Uge3VcL5GPVL/tBMeoVizxZey3MUekIHZ981iXW8fTbntYJNXMi2hN5w==",
9090+ is_localhost: true
+2-2
config/prod.exs
···55# manifest is generated by the `mix assets.deploy` task,
66# which you should run after static files are built and
77# before starting your production server.
88-config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
88+config :statusphere, StatusphereWeb.Endpoint,
99 cache_static_manifest: "priv/static/cache_manifest.json"
10101111# Force using SSL in production. This also sets the "strict-security-transport" header,
1212# known as HSTS. If you have a health check endpoint, you may want to exclude it below.
1313# Note `:force_ssl` is required to be set at compile-time.
1414-config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
1414+config :statusphere, StatusphereWeb.Endpoint,
1515 force_ssl: [rewrite_on: [:x_forwarded_proto]],
1616 exclude: [
1717 # paths: ["/health"],
+9-9
config/runtime.exs
···1212# If you use `mix release`, you need to explicitly enable the server
1313# by passing the PHX_SERVER=true when you start it:
1414#
1515-# PHX_SERVER=true bin/statusphere_elixir start
1515+# PHX_SERVER=true bin/statusphere start
1616#
1717# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
1818# script that automatically sets the env var above.
1919if System.get_env("PHX_SERVER") do
2020- config :statusphere_elixir, StatusphereElixirWeb.Endpoint, server: true
2020+ config :statusphere, StatusphereWeb.Endpoint, server: true
2121end
22222323-config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
2323+config :statusphere, StatusphereWeb.Endpoint,
2424 http: [port: String.to_integer(System.get_env("PORT", "4000"))]
25252626if config_env() == :prod do
···2828 System.get_env("DATABASE_PATH") ||
2929 raise """
3030 environment variable DATABASE_PATH is missing.
3131- For example: /etc/statusphere_elixir/statusphere_elixir.db
3131+ For example: /etc/statusphere/statusphere.db
3232 """
33333434- config :statusphere_elixir, StatusphereElixir.Repo,
3434+ config :statusphere, Statusphere.Repo,
3535 database: database_path,
3636 pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
3737···49495050 host = System.get_env("PHX_HOST") || "example.com"
51515252- config :statusphere_elixir, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
5252+ config :statusphere, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
53535454- config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
5454+ config :statusphere, StatusphereWeb.Endpoint,
5555 url: [host: host, port: 443, scheme: "https"],
5656 http: [
5757 # Enable IPv6 and bind on all interfaces.
···6767 # To get SSL working, you will need to add the `https` key
6868 # to your endpoint configuration:
6969 #
7070- # config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
7070+ # config :statusphere, StatusphereWeb.Endpoint,
7171 # https: [
7272 # ...,
7373 # port: 443,
···8989 # We also recommend setting `force_ssl` in your config/prod.exs,
9090 # ensuring no data is ever sent via http, always redirecting to https:
9191 #
9292- # config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
9292+ # config :statusphere, StatusphereWeb.Endpoint,
9393 # force_ssl: [hsts: true]
9494 #
9595 # Check `Plug.SSL` for all available options in `force_ssl`.
+3-3
config/test.exs
···55# The MIX_TEST_PARTITION environment variable can be used
66# to provide built-in test partitioning in CI environment.
77# Run `mix help test` for more information.
88-config :statusphere_elixir, StatusphereElixir.Repo,
99- database: Path.expand("../statusphere_elixir_test.db", __DIR__),
88+config :statusphere, Statusphere.Repo,
99+ database: Path.expand("../statusphere_test.db", __DIR__),
1010 pool_size: 5,
1111 pool: Ecto.Adapters.SQL.Sandbox
12121313# We don't run a server during test. If one is required,
1414# you can enable the server option below.
1515-config :statusphere_elixir, StatusphereElixirWeb.Endpoint,
1515+config :statusphere, StatusphereWeb.Endpoint,
1616 http: [ip: {127, 0, 0, 1}, port: 4002],
1717 secret_key_base: "AjDaXXlcrR04FEL+g7EV1+pKX7Fnvuhp63uWWK4I8zwKYmgReKy4WxqvdSNDdoT7",
1818 server: false
+41
lib/statusphere/application.ex
···11+defmodule Statusphere.Application do
22+ # See https://hexdocs.pm/elixir/Application.html
33+ # for more information on OTP Applications
44+ @moduledoc false
55+66+ use Application
77+88+ @impl true
99+ def start(_type, _args) do
1010+ children = [
1111+ StatusphereWeb.Telemetry,
1212+ Statusphere.Repo,
1313+ {Ecto.Migrator,
1414+ repos: Application.fetch_env!(:statusphere, :ecto_repos), skip: skip_migrations?()},
1515+ {DNSCluster, query: Application.get_env(:statusphere, :dns_cluster_query) || :ignore},
1616+ {Phoenix.PubSub, name: Statusphere.PubSub},
1717+ # Start a worker by calling: Statusphere.Worker.start_link(arg)
1818+ # {Statusphere.Worker, arg},
1919+ # Start to serve requests, typically the last entry
2020+ StatusphereWeb.Endpoint
2121+ ]
2222+2323+ # See https://hexdocs.pm/elixir/Supervisor.html
2424+ # for other strategies and supported options
2525+ opts = [strategy: :one_for_one, name: Statusphere.Supervisor]
2626+ Supervisor.start_link(children, opts)
2727+ end
2828+2929+ # Tell Phoenix to update the endpoint configuration
3030+ # whenever the application is updated.
3131+ @impl true
3232+ def config_change(changed, _new, removed) do
3333+ StatusphereWeb.Endpoint.config_change(changed, removed)
3434+ :ok
3535+ end
3636+3737+ defp skip_migrations?() do
3838+ # By default, sqlite migrations are run when using a release
3939+ System.get_env("RELEASE_NAME") == nil
4040+ end
4141+end
+5
lib/statusphere/repo.ex
···11+defmodule Statusphere.Repo do
22+ use Ecto.Repo,
33+ otp_app: :statusphere,
44+ adapter: Ecto.Adapters.SQLite3
55+end
+2-2
lib/statusphere_elixir.ex
lib/statusphere.ex
···11-defmodule StatusphereElixir do
11+defmodule Statusphere do
22 @moduledoc """
33- StatusphereElixir keeps the contexts that define your domain
33+ Statusphere keeps the contexts that define your domain
44 and business logic.
5566 Contexts are also responsible for managing your data, regardless
-41
lib/statusphere_elixir/application.ex
···11-defmodule StatusphereElixir.Application do
22- # See https://hexdocs.pm/elixir/Application.html
33- # for more information on OTP Applications
44- @moduledoc false
55-66- use Application
77-88- @impl true
99- def start(_type, _args) do
1010- children = [
1111- StatusphereElixirWeb.Telemetry,
1212- StatusphereElixir.Repo,
1313- {Ecto.Migrator,
1414- repos: Application.fetch_env!(:statusphere_elixir, :ecto_repos), skip: skip_migrations?()},
1515- {DNSCluster, query: Application.get_env(:statusphere_elixir, :dns_cluster_query) || :ignore},
1616- {Phoenix.PubSub, name: StatusphereElixir.PubSub},
1717- # Start a worker by calling: StatusphereElixir.Worker.start_link(arg)
1818- # {StatusphereElixir.Worker, arg},
1919- # Start to serve requests, typically the last entry
2020- StatusphereElixirWeb.Endpoint
2121- ]
2222-2323- # See https://hexdocs.pm/elixir/Supervisor.html
2424- # for other strategies and supported options
2525- opts = [strategy: :one_for_one, name: StatusphereElixir.Supervisor]
2626- Supervisor.start_link(children, opts)
2727- end
2828-2929- # Tell Phoenix to update the endpoint configuration
3030- # whenever the application is updated.
3131- @impl true
3232- def config_change(changed, _new, removed) do
3333- StatusphereElixirWeb.Endpoint.config_change(changed, removed)
3434- :ok
3535- end
3636-3737- defp skip_migrations?() do
3838- # By default, sqlite migrations are run when using a release
3939- System.get_env("RELEASE_NAME") == nil
4040- end
4141-end
-5
lib/statusphere_elixir/repo.ex
···11-defmodule StatusphereElixir.Repo do
22- use Ecto.Repo,
33- otp_app: :statusphere_elixir,
44- adapter: Ecto.Adapters.SQLite3
55-end
···11-defmodule StatusphereElixirWeb do
11+defmodule StatusphereWeb do
22 @moduledoc """
33 The entrypoint for defining your web interface, such
44 as controllers, components, channels, and so on.
5566 This can be used in your application as:
7788- use StatusphereElixirWeb, :controller
99- use StatusphereElixirWeb, :html
88+ use StatusphereWeb, :controller
99+ use StatusphereWeb, :html
10101111 The definitions below will be executed for every controller,
1212 component, etc, so keep them short and clean, focused
···8080 # HTML escaping functionality
8181 import Phoenix.HTML
8282 # Core UI components
8383- import StatusphereElixirWeb.CoreComponents
8383+ import StatusphereWeb.CoreComponents
84848585 # Common modules used in templates
8686 alias Phoenix.LiveView.JS
8787- alias StatusphereElixirWeb.Layouts
8787+ alias StatusphereWeb.Layouts
88888989 # Routes generation with the ~p sigil
9090 unquote(verified_routes())
···9494 def verified_routes do
9595 quote do
9696 use Phoenix.VerifiedRoutes,
9797- endpoint: StatusphereElixirWeb.Endpoint,
9898- router: StatusphereElixirWeb.Router,
9999- statics: StatusphereElixirWeb.static_paths()
9797+ endpoint: StatusphereWeb.Endpoint,
9898+ router: StatusphereWeb.Router,
9999+ statics: StatusphereWeb.static_paths()
100100 end
101101 end
102102
···11-defmodule StatusphereElixirWeb.Layouts do
11+defmodule StatusphereWeb.Layouts do
22 @moduledoc """
33 This module holds layouts and related functionality
44 used by your application.
55 """
66- use StatusphereElixirWeb, :html
66+ use StatusphereWeb, :html
7788 # Embed all files in layouts/* within this module.
99 # The default root.html.heex file contains the HTML
···11-defmodule StatusphereElixirWeb.ErrorHTML do
11+defmodule StatusphereWeb.ErrorHTML do
22 @moduledoc """
33 This module is invoked by your endpoint in case of errors on HTML requests.
4455 See config/config.exs.
66 """
77- use StatusphereElixirWeb, :html
77+ use StatusphereWeb, :html
8899 # If you want to customize your error pages,
1010 # uncomment the embed_templates/1 call below
1111 # and add pages to the error directory:
1212 #
1313- # * lib/statusphere_elixir_web/controllers/error_html/404.html.heex
1414- # * lib/statusphere_elixir_web/controllers/error_html/500.html.heex
1313+ # * lib/statusphere_web/controllers/error_html/404.html.heex
1414+ # * lib/statusphere_web/controllers/error_html/500.html.heex
1515 #
1616 # embed_templates "error_html/*"
1717
···11-defmodule StatusphereElixirWeb.ErrorJSON do
11+defmodule StatusphereWeb.ErrorJSON do
22 @moduledoc """
33 This module is invoked by your endpoint in case of errors on JSON requests.
44
···11-defmodule StatusphereElixirWeb.PageController do
22- use StatusphereElixirWeb, :controller
33-44- def home(conn, _params) do
55- render(conn, :home)
66- end
77-end
···11-defmodule StatusphereElixirWeb.PageHTML do
11+defmodule StatusphereWeb.PageHTML do
22 @moduledoc """
33 This module contains pages rendered by PageController.
4455 See the `page_html` directory for all templates available.
66 """
77- use StatusphereElixirWeb, :html
77+ use StatusphereWeb, :html
8899 embed_templates "page_html/*"
1010end
···11-defmodule StatusphereElixirWeb.Endpoint do
22- use Phoenix.Endpoint, otp_app: :statusphere_elixir
11+defmodule StatusphereWeb.Endpoint do
22+ use Phoenix.Endpoint, otp_app: :statusphere
3344 # The session will be stored in the cookie and signed,
55 # this means its contents can be read but not tampered with.
66 # Set :encryption_salt if you would also like to encrypt it.
77 @session_options [
88 store: :cookie,
99- key: "_statusphere_elixir_key",
99+ key: "_statusphere_key",
1010 signing_salt: "zbKtWcZI",
1111 same_site: "Lax"
1212 ]
···2222 # static files generated by running `phx.digest`.
2323 plug Plug.Static,
2424 at: "/",
2525- from: :statusphere_elixir,
2525+ from: :statusphere,
2626 gzip: not code_reloading?,
2727- only: StatusphereElixirWeb.static_paths(),
2727+ only: StatusphereWeb.static_paths(),
2828 raise_on_missing_only: code_reloading?
29293030 # Code reloading can be explicitly enabled under the
···3333 socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
3434 plug Phoenix.LiveReloader
3535 plug Phoenix.CodeReloader
3636- plug Phoenix.Ecto.CheckRepoStatus, otp_app: :statusphere_elixir
3636+ plug Phoenix.Ecto.CheckRepoStatus, otp_app: :statusphere
3737 end
38383939 plug Phoenix.LiveDashboard.RequestLogger,
···5151 plug Plug.MethodOverride
5252 plug Plug.Head
5353 plug Plug.Session, @session_options
5454- plug StatusphereElixirWeb.Router
5454+ plug StatusphereWeb.Router
5555end
···11-defmodule StatusphereElixirWeb.Router do
22- use StatusphereElixirWeb, :router
11+defmodule StatusphereWeb.Router do
22+ use StatusphereWeb, :router
3344 pipeline :browser do
55 plug :accepts, ["html"]
66 plug :fetch_session
77 plug :fetch_live_flash
88- plug :put_root_layout, html: {StatusphereElixirWeb.Layouts, :root}
88+ plug :put_root_layout, html: {StatusphereWeb.Layouts, :root}
99 plug :protect_from_forgery
1010 plug :put_secure_browser_headers
1111 end
···1414 plug :accepts, ["json"]
1515 end
16161717- scope "/", StatusphereElixirWeb do
1717+ scope "/", StatusphereWeb do
1818 pipe_through :browser
19192020 get "/", PageController, :home
2121 end
2222+2323+ forward "/oauth", Atex.OAuth.Plug, callback: {__MODULE__, :oauth_callback, []}
22242325 # Other scopes may use custom stacks.
2424- # scope "/api", StatusphereElixirWeb do
2626+ # scope "/api", StatusphereWeb do
2527 # pipe_through :api
2628 # end
27292830 # Enable LiveDashboard in development
2929- if Application.compile_env(:statusphere_elixir, :dev_routes) do
3131+ if Application.compile_env(:statusphere, :dev_routes) do
3032 # If you want to use the LiveDashboard in production, you should put
3133 # it behind authentication and allow only admins to access it.
3234 # If your application does not have an admins-only section yet,
···3739 scope "/dev" do
3840 pipe_through :browser
39414040- live_dashboard "/dashboard", metrics: StatusphereElixirWeb.Telemetry
4242+ live_dashboard "/dashboard", metrics: StatusphereWeb.Telemetry
4143 end
4444+ end
4545+4646+ def oauth_callback(conn) do
4747+ redirect(conn, to: "/")
4248 end
4349end
···11-defmodule StatusphereElixirWeb.Telemetry do
11+defmodule StatusphereWeb.Telemetry do
22 use Supervisor
33 import Telemetry.Metrics
44···5353 ),
54545555 # Database Metrics
5656- summary("statusphere_elixir.repo.query.total_time",
5656+ summary("statusphere.repo.query.total_time",
5757 unit: {:native, :millisecond},
5858 description: "The sum of the other measurements"
5959 ),
6060- summary("statusphere_elixir.repo.query.decode_time",
6060+ summary("statusphere.repo.query.decode_time",
6161 unit: {:native, :millisecond},
6262 description: "The time spent decoding the data received from the database"
6363 ),
6464- summary("statusphere_elixir.repo.query.query_time",
6464+ summary("statusphere.repo.query.query_time",
6565 unit: {:native, :millisecond},
6666 description: "The time spent executing the query"
6767 ),
6868- summary("statusphere_elixir.repo.query.queue_time",
6868+ summary("statusphere.repo.query.queue_time",
6969 unit: {:native, :millisecond},
7070 description: "The time spent waiting for a database connection"
7171 ),
7272- summary("statusphere_elixir.repo.query.idle_time",
7272+ summary("statusphere.repo.query.idle_time",
7373 unit: {:native, :millisecond},
7474 description:
7575 "The time the connection spent waiting before being checked out for the query"
···8787 [
8888 # A module, function and arguments to be invoked periodically.
8989 # This function must call :telemetry.execute/3 and a metric must be added above.
9090- # {StatusphereElixirWeb, :count_users, []}
9090+ # {StatusphereWeb, :count_users, []}
9191 ]
9292 end
9393end
···11+defmodule StatusphereWeb.PageController do
22+ use StatusphereWeb, :controller
33+44+ def home(conn, _params) do
55+ render(conn, :home)
66+ end
77+end
···55# Inside the script, you can read and write to any of your
66# repositories directly:
77#
88-# StatusphereElixir.Repo.insert!(%StatusphereElixir.SomeSchema{})
88+# Statusphere.Repo.insert!(%Statusphere.SomeSchema{})
99#
1010# We recommend using the bang functions (`insert!`, `update!`
1111# and so on) as they will fail if something goes wrong.
···11-defmodule StatusphereElixirWeb.PageControllerTest do
22- use StatusphereElixirWeb.ConnCase
11+defmodule StatusphereWeb.PageControllerTest do
22+ use StatusphereWeb.ConnCase
3344 test "GET /", %{conn: conn} do
55 conn = get(conn, ~p"/")
+6-6
test/support/conn_case.ex
···11-defmodule StatusphereElixirWeb.ConnCase do
11+defmodule StatusphereWeb.ConnCase do
22 @moduledoc """
33 This module defines the test case to be used by
44 tests that require setting up a connection.
···1111 we enable the SQL sandbox, so changes done to the database
1212 are reverted at the end of every test. If you are using
1313 PostgreSQL, you can even run database tests asynchronously
1414- by setting `use StatusphereElixirWeb.ConnCase, async: true`, although
1414+ by setting `use StatusphereWeb.ConnCase, async: true`, although
1515 this option is not recommended for other databases.
1616 """
1717···2020 using do
2121 quote do
2222 # The default endpoint for testing
2323- @endpoint StatusphereElixirWeb.Endpoint
2323+ @endpoint StatusphereWeb.Endpoint
24242525- use StatusphereElixirWeb, :verified_routes
2525+ use StatusphereWeb, :verified_routes
26262727 # Import conveniences for testing with connections
2828 import Plug.Conn
2929 import Phoenix.ConnTest
3030- import StatusphereElixirWeb.ConnCase
3030+ import StatusphereWeb.ConnCase
3131 end
3232 end
33333434 setup tags do
3535- StatusphereElixir.DataCase.setup_sandbox(tags)
3535+ Statusphere.DataCase.setup_sandbox(tags)
3636 {:ok, conn: Phoenix.ConnTest.build_conn()}
3737 end
3838end
+6-6
test/support/data_case.ex
···11-defmodule StatusphereElixir.DataCase do
11+defmodule Statusphere.DataCase do
22 @moduledoc """
33 This module defines the setup for tests requiring
44 access to the application's data layer.
···1010 we enable the SQL sandbox, so changes done to the database
1111 are reverted at the end of every test. If you are using
1212 PostgreSQL, you can even run database tests asynchronously
1313- by setting `use StatusphereElixir.DataCase, async: true`, although
1313+ by setting `use Statusphere.DataCase, async: true`, although
1414 this option is not recommended for other databases.
1515 """
1616···18181919 using do
2020 quote do
2121- alias StatusphereElixir.Repo
2121+ alias Statusphere.Repo
22222323 import Ecto
2424 import Ecto.Changeset
2525 import Ecto.Query
2626- import StatusphereElixir.DataCase
2626+ import Statusphere.DataCase
2727 end
2828 end
29293030 setup tags do
3131- StatusphereElixir.DataCase.setup_sandbox(tags)
3131+ Statusphere.DataCase.setup_sandbox(tags)
3232 :ok
3333 end
3434···3636 Sets up the sandbox based on the test tags.
3737 """
3838 def setup_sandbox(tags) do
3939- pid = Ecto.Adapters.SQL.Sandbox.start_owner!(StatusphereElixir.Repo, shared: not tags[:async])
3939+ pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Statusphere.Repo, shared: not tags[:async])
4040 on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
4141 end
4242