Skip to content

Commit 3b8c737

Browse files
disable article compiler in prod
1 parent ccb6940 commit 3b8c737

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

config/runtime.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Config
2+
3+
config :boc, :articles_reloader_enabled, config_env() === :dev

lib/boc.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ defmodule Boc do
1010
def priv_path() do
1111
:code.priv_dir(:boc)
1212
end
13+
14+
def articles_reloader_enabled?() do
15+
dbg(Application.get_env(:boc, :articles_reloader_enabled))
16+
Application.get_env(:boc, :articles_reloader_enabled, false)
17+
end
1318
end

lib/boc/application.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ defmodule Boc.Application do
55

66
@impl true
77
def start(_type, _args) do
8-
children = [
9-
{Bandit, plug: Boc.Router},
10-
{Boc.Articles.DB, []},
11-
{Boc.ArticlesMonitor, []}
12-
]
8+
children =
9+
[
10+
{Bandit, plug: Boc.Router},
11+
{Boc.Articles.DB, []}
12+
] ++ if(Boc.articles_reloader_enabled?(), do: [{Boc.ArticlesMonitor, []}], else: [])
1313

1414
opts = [strategy: :one_for_one, name: Boc.Supervisor]
1515
Supervisor.start_link(children, opts)

0 commit comments

Comments
 (0)