Skip to content

Commit 2512e8b

Browse files
committed
initial commit
0 parents  commit 2512e8b

File tree

25 files changed

+923
-0
lines changed

25 files changed

+923
-0
lines changed

.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
import_deps: [:phoenix],
3+
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Temporary files, for example, from tests.
23+
/tmp/
24+
25+
# Ignore package tarball (built via "mix hex.build").
26+
vrhose-*.tar
27+

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# VRHose
2+
3+
To start your Phoenix server:
4+
5+
* Run `mix setup` to install and setup dependencies
6+
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
7+
8+
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
9+
10+
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
11+
12+
## Learn more
13+
14+
* Official website: https://www.phoenixframework.org/
15+
* Guides: https://hexdocs.pm/phoenix/overview.html
16+
* Docs: https://hexdocs.pm/phoenix
17+
* Forum: https://elixirforum.com/c/phoenix-forum
18+
* Source: https://github.com/phoenixframework/phoenix

config/config.exs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This file is responsible for configuring your application
2+
# and its dependencies with the aid of the Config module.
3+
#
4+
# This configuration file is loaded before any dependency and
5+
# is restricted to this project.
6+
7+
# General application configuration
8+
import Config
9+
10+
config :vrhose,
11+
namespace: VRHose,
12+
generators: [timestamp_type: :utc_datetime]
13+
14+
# Configures the endpoint
15+
config :vrhose, VRHoseWeb.Endpoint,
16+
url: [host: "localhost"],
17+
adapter: Bandit.PhoenixAdapter,
18+
render_errors: [
19+
formats: [json: VRHoseWeb.ErrorJSON],
20+
layout: false
21+
],
22+
pubsub_server: VRHose.PubSub,
23+
live_view: [signing_salt: "10KBJgAB"]
24+
25+
# Configures Elixir's Logger
26+
config :logger, :console,
27+
format: "$time $metadata[$level] $message\n",
28+
metadata: [:request_id]
29+
30+
# Use Jason for JSON parsing in Phoenix
31+
config :phoenix, :json_library, Jason
32+
33+
# Import environment specific config. This must remain at the bottom
34+
# of this file so it overrides the configuration defined above.
35+
import_config "#{config_env()}.exs"

config/dev.exs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import Config
2+
3+
# For development, we disable any cache and enable
4+
# debugging and code reloading.
5+
#
6+
# The watchers configuration can be used to run external
7+
# watchers to your application. For example, we can use it
8+
# to bundle .js and .css sources.
9+
config :vrhose, VRHoseWeb.Endpoint,
10+
# Binding to loopback ipv4 address prevents access from other machines.
11+
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
12+
http: [ip: {127, 0, 0, 1}, port: 4000],
13+
check_origin: false,
14+
code_reloader: true,
15+
debug_errors: true,
16+
secret_key_base: "XHJKI9w8ILE8BWHN9Wtb1ssJY6xCJqABWrCs+3Owghr13TUEvGlJ3OJRl0d3A5O3",
17+
watchers: []
18+
19+
# ## SSL Support
20+
#
21+
# In order to use HTTPS in development, a self-signed
22+
# certificate can be generated by running the following
23+
# Mix task:
24+
#
25+
# mix phx.gen.cert
26+
#
27+
# Run `mix help phx.gen.cert` for more information.
28+
#
29+
# The `http:` config above can be replaced with:
30+
#
31+
# https: [
32+
# port: 4001,
33+
# cipher_suite: :strong,
34+
# keyfile: "priv/cert/selfsigned_key.pem",
35+
# certfile: "priv/cert/selfsigned.pem"
36+
# ],
37+
#
38+
# If desired, both `http:` and `https:` keys can be
39+
# configured to run both http and https servers on
40+
# different ports.
41+
42+
# Enable dev routes for dashboard and mailbox
43+
config :vrhose, dev_routes: true
44+
45+
# Do not include metadata nor timestamps in development logs
46+
config :logger, :console, format: "[$level] $message\n"
47+
48+
# Set a higher stacktrace during development. Avoid configuring such
49+
# in production as building large stacktraces may be expensive.
50+
config :phoenix, :stacktrace_depth, 20
51+
52+
# Initialize plugs at runtime for faster development compilation
53+
config :phoenix, :plug_init_mode, :runtime

config/prod.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Config
2+
3+
# Do not print debug messages in production
4+
config :logger, level: :info
5+
6+
# Runtime production configuration, including reading
7+
# of environment variables, is done on config/runtime.exs.

config/runtime.exs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import Config
2+
3+
# config/runtime.exs is executed for all environments, including
4+
# during releases. It is executed after compilation and before the
5+
# system starts, so it is typically used to load production configuration
6+
# and secrets from environment variables or elsewhere. Do not define
7+
# any compile-time configuration in here, as it won't be applied.
8+
# The block below contains prod specific runtime configuration.
9+
10+
# ## Using releases
11+
#
12+
# If you use `mix release`, you need to explicitly enable the server
13+
# by passing the PHX_SERVER=true when you start it:
14+
#
15+
# PHX_SERVER=true bin/vrhose start
16+
#
17+
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
18+
# script that automatically sets the env var above.
19+
if System.get_env("PHX_SERVER") do
20+
config :vrhose, VRHoseWeb.Endpoint, server: true
21+
end
22+
23+
if config_env() == :prod do
24+
# The secret key base is used to sign/encrypt cookies and other secrets.
25+
# A default value is used in config/dev.exs and config/test.exs but you
26+
# want to use a different value for prod and you most likely don't want
27+
# to check this value into version control, so we use an environment
28+
# variable instead.
29+
secret_key_base =
30+
System.get_env("SECRET_KEY_BASE") ||
31+
raise """
32+
environment variable SECRET_KEY_BASE is missing.
33+
You can generate one by calling: mix phx.gen.secret
34+
"""
35+
36+
host = System.get_env("PHX_HOST") || "example.com"
37+
port = String.to_integer(System.get_env("PORT") || "4000")
38+
39+
config :vrhose, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
40+
41+
config :vrhose, VRHoseWeb.Endpoint,
42+
url: [host: host, port: 443, scheme: "https"],
43+
http: [
44+
# Enable IPv6 and bind on all interfaces.
45+
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
46+
# See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0
47+
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
48+
ip: {0, 0, 0, 0, 0, 0, 0, 0},
49+
port: port
50+
],
51+
secret_key_base: secret_key_base
52+
53+
# ## SSL Support
54+
#
55+
# To get SSL working, you will need to add the `https` key
56+
# to your endpoint configuration:
57+
#
58+
# config :vrhose, VRHoseWeb.Endpoint,
59+
# https: [
60+
# ...,
61+
# port: 443,
62+
# cipher_suite: :strong,
63+
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
64+
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")
65+
# ]
66+
#
67+
# The `cipher_suite` is set to `:strong` to support only the
68+
# latest and more secure SSL ciphers. This means old browsers
69+
# and clients may not be supported. You can set it to
70+
# `:compatible` for wider support.
71+
#
72+
# `:keyfile` and `:certfile` expect an absolute path to the key
73+
# and cert in disk or a relative path inside priv, for example
74+
# "priv/ssl/server.key". For all supported SSL configuration
75+
# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1
76+
#
77+
# We also recommend setting `force_ssl` in your config/prod.exs,
78+
# ensuring no data is ever sent via http, always redirecting to https:
79+
#
80+
# config :vrhose, VRHoseWeb.Endpoint,
81+
# force_ssl: [hsts: true]
82+
#
83+
# Check `Plug.SSL` for all available options in `force_ssl`.
84+
end

config/test.exs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Config
2+
3+
# We don't run a server during test. If one is required,
4+
# you can enable the server option below.
5+
config :vrhose, VRHoseWeb.Endpoint,
6+
http: [ip: {127, 0, 0, 1}, port: 4002],
7+
secret_key_base: "QrZ1l8Qns/Zzs56F+5T+RKPNwD1sn4Wx8H8J5Jl701ShIdPgicXgxL+4SEdscdQu",
8+
server: false
9+
10+
# Print only warnings and errors during test
11+
config :logger, level: :warning
12+
13+
# Initialize plugs at runtime for faster test compilation
14+
config :phoenix, :plug_init_mode, :runtime

lib/vrhose.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
defmodule VRHose do
2+
@moduledoc """
3+
VRHose keeps the contexts that define your domain
4+
and business logic.
5+
6+
Contexts are also responsible for managing your data, regardless
7+
if it comes from the database, an external API or others.
8+
"""
9+
end

lib/vrhose/application.ex

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
defmodule VRHose.Application do
2+
# See https://hexdocs.pm/elixir/Application.html
3+
# for more information on OTP Applications
4+
@moduledoc false
5+
6+
use Application
7+
8+
@impl true
9+
def start(_type, _args) do
10+
children = [
11+
VRHoseWeb.Telemetry,
12+
{DNSCluster, query: Application.get_env(:vrhose, :dns_cluster_query) || :ignore},
13+
{Phoenix.PubSub, name: VRHose.PubSub},
14+
# Start a worker by calling: VRHose.Worker.start_link(arg)
15+
# {VRHose.Worker, arg},
16+
# Start to serve requests, typically the last entry
17+
VRHose.Ingestor,
18+
VRHoseWeb.Endpoint
19+
]
20+
21+
# See https://hexdocs.pm/elixir/Supervisor.html
22+
# for other strategies and supported options
23+
opts = [strategy: :one_for_one, name: VRHose.Supervisor]
24+
Supervisor.start_link(children, opts)
25+
end
26+
27+
# Tell Phoenix to update the endpoint configuration
28+
# whenever the application is updated.
29+
@impl true
30+
def config_change(changed, _new, removed) do
31+
VRHoseWeb.Endpoint.config_change(changed, removed)
32+
:ok
33+
end
34+
end

0 commit comments

Comments
 (0)