Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config cleanup #1165

Merged
merged 13 commits into from
Dec 28, 2023
6 changes: 0 additions & 6 deletions .env

This file was deleted.

1 change: 0 additions & 1 deletion .env.dev

This file was deleted.

4 changes: 0 additions & 4 deletions .env.test

This file was deleted.

34 changes: 7 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
# App artifacts
/_build
/db
/deps
/*.ez
/deps/
/assets/node_modules/
/priv/static/
/tmp/

# Generated on crash by the VM
erl_crash.dump

# Files matching config/*.secret.exs pattern contain sensitive
# data and you should not commit them into version control.
#
# Alternatively, you may comment the line below and commit the
# secrets files as long as you replace their contents by environment
# variables.
/config/*.secret.exs

.elixir_ls
.vscode
node_modules
*.iml
# Test artifact
test/fixtures/ssl/device-root-ca.srl

/config/*.secret.exs
/priv/static
.env
.elixir_ls
.vscode

node_modules/
assets/*.log
tmp

gproc_dist*

test/fixtures/ssl/device-root-ca.srl

/remote_host
.env*
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

54 changes: 24 additions & 30 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,39 @@ config :phoenix,
]

##
# NervesHub Device
# NervesHub
#
config :nerves_hub,
env: Mix.env(),
namespace: NervesHub,
ecto_repos: [NervesHub.Repo]

# Configures the endpoint
##
# NervesHub Device
#
config :nerves_hub, NervesHubWeb.DeviceEndpoint,
adapter: Bandit.PhoenixAdapter,
render_errors: [view: NervesHubWeb.ErrorView, accepts: ~w(html json)],
pubsub_server: NervesHub.PubSub

##
# NervesHub
# NervesHub Web
#
config :nerves_hub,
env: Mix.env(),
namespace: NervesHub,
ecto_repos: [NervesHub.Repo],
from_email: System.get_env("FROM_EMAIL", "[email protected]")
config :nerves_hub, NervesHubWeb.Endpoint,
adapter: Bandit.PhoenixAdapter,
secret_key_base: "ZH9GG2S5CwIMWXBg92wUuoyKFrjgqaAybHLTLuUk1xZO0HeidcJbnMBSTHDcyhSn",
live_view: [
signing_salt: "Kct3W8U7uQ6KAczYjzNbiYS6A8Pbtk3f"
],
render_errors: [view: NervesHubWeb.ErrorView, accepts: ~w(html json)],
pubsub_server: NervesHub.PubSub

##
# Database and Oban
#
config :nerves_hub, NervesHub.Repo,
queue_target: 500,
queue_interval: 5_000

config :nerves_hub, Oban,
repo: NervesHub.ObanRepo,
Expand All @@ -45,30 +61,8 @@ config :nerves_hub, Oban,
]}
]

config :nerves_hub, NervesHub.Repo,
queue_target: 500,
queue_interval: 5_000

##
# NervesHubWWW
#
config :nerves_hub,
ecto_repos: [NervesHub.Repo],
# Options are :ssl or :header
websocket_auth_methods: [:ssl]

config :nerves_hub, NervesHubWeb.Gettext, default_locale: "en"

# Configures the endpoint
config :nerves_hub, NervesHubWeb.Endpoint,
adapter: Bandit.PhoenixAdapter,
secret_key_base: "ZH9GG2S5CwIMWXBg92wUuoyKFrjgqaAybHLTLuUk1xZO0HeidcJbnMBSTHDcyhSn",
live_view: [
signing_salt: "Kct3W8U7uQ6KAczYjzNbiYS6A8Pbtk3f"
],
render_errors: [view: NervesHubWeb.ErrorView, accepts: ~w(html json)],
pubsub_server: NervesHub.PubSub

config :swoosh, :api_client, Swoosh.ApiClient.Finch

# Environment specific config
Expand Down
88 changes: 42 additions & 46 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
import Config

# Start all of the applications
config :nerves_hub, app: "all"

config :nerves_hub, deploy_env: "dev"

ssl_dir =
(System.get_env("NERVES_HUB_CA_DIR") || Path.join([__DIR__, "../test/fixtures/ssl/"]))
|> Path.expand()

config :logger, :console, format: "[$level] $message\n"
config :phoenix, :stacktrace_depth, 20

# Configure your database
config :nerves_hub, NervesHub.Repo,
url: "postgres://localhost/nerves_hub_dev",
show_sensitive_data_on_connection_error: true,
pool_size: 10

config :nerves_hub, NervesHub.ObanRepo,
url: "postgres://localhost/nerves_hub_dev",
show_sensitive_data_on_connection_error: true,
pool_size: 10
##
# NervesHub Web
#
config :nerves_hub, NervesHubWeb.Endpoint,
url: [
host: System.get_env("WEB_HOST", "localhost"),
scheme: System.get_env("WEB_SCHEME", "http"),
port: String.to_integer(System.get_env("WEB_PORT", "4000"))
],
http: [ip: {0, 0, 0, 0}, port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [npm: ["run", "watch", cd: Path.expand("../assets", __DIR__)]],
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
~r{lib/nerves_hub_www_web/views/.*(ex)$},
~r{lib/nerves_hub_www_web/templates/.*(eex|md)$},
~r{lib/nerves_hube_www_web/live/.*(ex)$}
]
]

##
# NervesHub Device
Expand Down Expand Up @@ -58,7 +66,22 @@ config :nerves_hub, NervesHubWeb.DeviceEndpoint,
]

##
# NervesHub
# Database and Oban
#
config :nerves_hub, NervesHub.Repo,
url: System.get_env("DATABASE_URL", "postgres://postgres:postgres@localhost/nerves_hub_dev"),
show_sensitive_data_on_connection_error: true,
pool_size: 10,
ssl: false

config :nerves_hub, NervesHub.ObanRepo,
url: System.get_env("DATABASE_URL", "postgres://postgres:postgres@localhost/nerves_hub_dev"),
show_sensitive_data_on_connection_error: true,
pool_size: 10,
ssl: false

##
# Firmware upload
#
config :nerves_hub, firmware_upload: NervesHub.Firmwares.Upload.File

Expand All @@ -74,38 +97,11 @@ config :nerves_hub, NervesHub.Uploads.File,
local_path: Path.expand("tmp/uploads"),
public_path: "/uploads"

# config :nerves_hub, NervesHub.Firmwares.Upload.S3, bucket: System.get_env("S3_BUCKET_NAME")

config :nerves_hub, NervesHub.Repo, ssl: false

config :nerves_hub, NervesHub.ObanRepo, ssl: false

##
# Other
#
config :nerves_hub, NervesHub.SwooshMailer, adapter: Swoosh.Adapters.Local

config :nerves_hub, NervesHub.RateLimit, limit: 10

##
# NervesHubWWW
#
config :nerves_hub, NervesHubWeb.Endpoint,
url: [
host: System.get_env("WEB_HOST", "localhost"),
scheme: System.get_env("WEB_SCHEME", "http"),
port: String.to_integer(System.get_env("WEB_PORT", "4000"))
],
http: [ip: {0, 0, 0, 0}, port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [npm: ["run", "watch", cd: Path.expand("../assets", __DIR__)]],
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
~r{lib/nerves_hub_www_web/views/.*(ex)$},
~r{lib/nerves_hub_www_web/templates/.*(eex|md)$},
~r{lib/nerves_hube_www_web/live/.*(ex)$}
]
]

config :sentry, environment_name: :development
16 changes: 8 additions & 8 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ config :logger, level: :info, backends: [:console, Sentry.LoggerBackend]

config :phoenix, logger: false

##
# NervesHub Web
#
config :nerves_hub, NervesHubWeb.Endpoint,
server: true,
force_ssl: [rewrite_on: [:x_forwarded_proto]]

##
# NervesHub Device
#
config :nerves_hub, NervesHubWeb.DeviceEndpoint, server: true

##
# NervesHub
# Database and Oban
#
config :nerves_hub, NervesHub.Repo, pool_size: 20

config :nerves_hub, NervesHub.ObanRepo, pool_size: 10

##
# NervesHubWWW
#
config :nerves_hub, NervesHubWeb.Endpoint,
server: true,
force_ssl: [rewrite_on: [:x_forwarded_proto]]
Loading
Loading