Env-based configs (#2)

This commit is contained in:
Alexey 2020-03-06 14:30:55 +03:00 committed by GitHub
parent 0ec747d87b
commit 526ad6edda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 56 deletions

View File

@ -1,35 +1,10 @@
import Config
config :pathfinder, Woody.Server,
ip: "0.0.0.0",
port: 8022
# Common compile-time app env
config :pathfinder, ecto_repos: [NewWay.Repo]
config :pathfinder, NewWay.Repo,
database: "nw",
username: "postgres",
password: "postgres",
hostname: "postgres"
config :pathfinder, :logger, [
{:handler, :default, :logger_std_h, %{
:config => %{
:type => {:file, 'console.json'}
},
:formatter => {:logger_logstash_formatter, %{
:exclude_meta_fields => [:ansi_color, :application, :file, :line, :mfa, :pid, :gl, :domain]
}}
}},
{:handler, Logger, :logger_std_h, %{
:config => %{
:type => {:file, 'console.json'}
},
:formatter => {:logger_logstash_formatter, %{
:exclude_meta_fields => [:ansi_color, :application, :file, :line, :mfa, :pid, :gl, :domain]
}}
}}
]
# Dont use Elixir's logger
config :logger, backends: []
import_config("#{Mix.env()}.exs")

32
config/dev.exs Normal file
View File

@ -0,0 +1,32 @@
import Config
# Development compile-time app env
config :pathfinder, Woody.Server,
ip: "0.0.0.0",
port: 8022
config :pathfinder, NewWay.Repo,
database: "nw",
username: "postgres",
password: "postgres",
hostname: "postgres"
config :pathfinder, :logger, [
{:handler, :default, :logger_std_h, %{
:config => %{
:type => {:file, 'console.json'}
},
:formatter => {:logger_logstash_formatter, %{
:exclude_meta_fields => [:ansi_color, :application, :file, :line, :mfa, :pid, :gl, :domain]
}}
}},
{:handler, Logger, :logger_std_h, %{
:config => %{
:type => {:file, 'console.json'}
},
:formatter => {:logger_logstash_formatter, %{
:exclude_meta_fields => [:ansi_color, :application, :file, :line, :mfa, :pid, :gl, :domain]
}}
}}
]

6
config/prod.exs Normal file
View File

@ -0,0 +1,6 @@
import Config
# Production compile-time app env
config :pathfinder, NewWay.Repo,
show_sensitive_data_on_connection_error: :false

View File

@ -1,30 +1,3 @@
import Config
config :pathfinder, Woody.Server,
ip: "0.0.0.0",
port: 8022
config :pathfinder, NewWay.Repo,
database: "nw",
username: "postgres",
password: "postgres",
hostname: "postgres"
config :pathfinder, :logger, [
{:handler, :default, :logger_std_h, %{
:config => %{
:type => {:file, 'console.json'}
},
:formatter => {:logger_logstash_formatter, %{
:exclude_meta_fields => [:ansi_color, :application, :file, :line, :mfa, :pid, :gl, :domain]
}}
}},
{:handler, Logger, :logger_std_h, %{
:config => %{
:type => {:file, 'console.json'}
},
:formatter => {:logger_logstash_formatter, %{
:exclude_meta_fields => [:ansi_color, :application, :file, :line, :mfa, :pid, :gl, :domain]
}}
}}
]
# Configure release environment here

5
config/test.exs Normal file
View File

@ -0,0 +1,5 @@
import Config
# Test compile-time app env
import_config("dev.exs")