Move ErrorTracker to its own repo and file
Note that the SQlite adapter supports version 2 onwards.
This commit is contained in:
+4
-2
@@ -8,7 +8,7 @@
|
|||||||
import Config
|
import Config
|
||||||
|
|
||||||
config :music_library,
|
config :music_library,
|
||||||
ecto_repos: [MusicLibrary.Repo],
|
ecto_repos: [MusicLibrary.Repo, MusicLibrary.ErrorRepo],
|
||||||
generators: [timestamp_type: :utc_datetime, binary_id: true]
|
generators: [timestamp_type: :utc_datetime, binary_id: true]
|
||||||
|
|
||||||
config :music_library, MusicLibraryWeb, login_password: "change me", api_token: "change me"
|
config :music_library, MusicLibraryWeb, login_password: "change me", api_token: "change me"
|
||||||
@@ -69,10 +69,12 @@ config :logger, :console,
|
|||||||
config :phoenix, :json_library, Jason
|
config :phoenix, :json_library, Jason
|
||||||
|
|
||||||
config :error_tracker,
|
config :error_tracker,
|
||||||
repo: MusicLibrary.Repo,
|
repo: MusicLibrary.ErrorRepo,
|
||||||
otp_app: :music_library,
|
otp_app: :music_library,
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
config :music_library, MusicLibrary.ErrorRepo, priv: "priv/error_repo"
|
||||||
|
|
||||||
# Import environment specific config. This must remain at the bottom
|
# Import environment specific config. This must remain at the bottom
|
||||||
# of this file so it overrides the configuration defined above.
|
# of this file so it overrides the configuration defined above.
|
||||||
import_config "#{config_env()}.exs"
|
import_config "#{config_env()}.exs"
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ config :music_library, MusicLibrary.Repo,
|
|||||||
stacktrace: true,
|
stacktrace: true,
|
||||||
show_sensitive_data_on_connection_error: true
|
show_sensitive_data_on_connection_error: true
|
||||||
|
|
||||||
|
config :music_library, MusicLibrary.ErrorRepo,
|
||||||
|
database: Path.expand("../data/music_library_errors_dev.db", __DIR__),
|
||||||
|
pool_size: 5,
|
||||||
|
stacktrace: true,
|
||||||
|
show_sensitive_data_on_connection_error: true
|
||||||
|
|
||||||
# For development, we disable any cache and enable
|
# For development, we disable any cache and enable
|
||||||
# debugging and code reloading.
|
# debugging and code reloading.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -51,6 +51,19 @@ if config_env() == :prod do
|
|||||||
cache_size: -8000,
|
cache_size: -8000,
|
||||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
|
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
|
||||||
|
|
||||||
|
error_database_path =
|
||||||
|
System.get_env("ERROR_DATABASE_PATH") ||
|
||||||
|
raise """
|
||||||
|
environment variable ERROR_DATABASE_PATH is missing.
|
||||||
|
For example: /etc/music_library/music_library_errors.db
|
||||||
|
"""
|
||||||
|
|
||||||
|
config :music_library, MusicLibrary.ErrorRepo,
|
||||||
|
database: error_database_path,
|
||||||
|
# 16MB * pool_size = base memory usage
|
||||||
|
cache_size: -8000,
|
||||||
|
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
|
||||||
|
|
||||||
# The secret key base is used to sign/encrypt cookies and other secrets.
|
# The secret key base is used to sign/encrypt cookies and other secrets.
|
||||||
# A default value is used in config/dev.exs and config/test.exs but you
|
# A default value is used in config/dev.exs and config/test.exs but you
|
||||||
# want to use a different value for prod and you most likely don't want
|
# want to use a different value for prod and you most likely don't want
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ config :music_library, MusicLibrary.Repo,
|
|||||||
pool_size: 32,
|
pool_size: 32,
|
||||||
pool: Ecto.Adapters.SQL.Sandbox
|
pool: Ecto.Adapters.SQL.Sandbox
|
||||||
|
|
||||||
|
config :music_library, MusicLibrary.ErrorRepo,
|
||||||
|
database: Path.expand("../data/music_library_errors_test.db", __DIR__),
|
||||||
|
pool_size: 32,
|
||||||
|
pool: Ecto.Adapters.SQL.Sandbox
|
||||||
|
|
||||||
# We don't run a server during test. If one is required,
|
# We don't run a server during test. If one is required,
|
||||||
# you can enable the server option below.
|
# you can enable the server option below.
|
||||||
config :music_library, MusicLibraryWeb.Endpoint,
|
config :music_library, MusicLibraryWeb.Endpoint,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ defmodule MusicLibrary.Application do
|
|||||||
children = [
|
children = [
|
||||||
MusicLibraryWeb.Telemetry,
|
MusicLibraryWeb.Telemetry,
|
||||||
MusicLibrary.Repo,
|
MusicLibrary.Repo,
|
||||||
|
MusicLibrary.ErrorRepo,
|
||||||
{Ecto.Migrator,
|
{Ecto.Migrator,
|
||||||
repos: Application.fetch_env!(:music_library, :ecto_repos), skip: skip_migrations?()},
|
repos: Application.fetch_env!(:music_library, :ecto_repos), skip: skip_migrations?()},
|
||||||
{DNSCluster, query: Application.get_env(:music_library, :dns_cluster_query) || :ignore},
|
{DNSCluster, query: Application.get_env(:music_library, :dns_cluster_query) || :ignore},
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
defmodule MusicLibrary.ErrorRepo do
|
||||||
|
use Ecto.Repo,
|
||||||
|
otp_app: :music_library,
|
||||||
|
adapter: Ecto.Adapters.SQLite3
|
||||||
|
end
|
||||||
+1
-2
@@ -2,6 +2,5 @@ defmodule MusicLibrary.Repo.Migrations.AddErrorTracker do
|
|||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
def up, do: ErrorTracker.Migration.up(version: 4)
|
def up, do: ErrorTracker.Migration.up(version: 4)
|
||||||
|
|
||||||
# We specify `version: 1` in `down`, to ensure we remove all migrations.
|
def down, do: ErrorTracker.Migration.down(version: 2)
|
||||||
def down, do: ErrorTracker.Migration.down(version: 1)
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user