Krug.EctoEnviromentDecisor behaviour (Krug v2.0.27) View Source
Defines a behaviour for higher-level Ecto enviroment changes decisor. Whit this is possible change a db connection from/to dev/pro in build time, if we use a .sh script for re-generate one module that implements this.
This module should be passed as decisor:
value option
on module that extends Krug.EnviromentReader
Utilization Example:
defmodule MyApp.EnviromentDecisor do
@behaviour Krug.EctoEnviromentDecisor
@impl Krug.EctoEnviromentDecisor
def get_enviroment_type() do
"dev"
end
end
defmodule MyApp.Enviroment.Reader do
use Krug.EnviromentReader, decisor: MyApp.EnviromentDecisor, enviroment: MyApp.Enviroment
end
Link to this section Summary
Callbacks
Should return "dev" or "prod". All other values will generate problems.
Link to this section Callbacks
Specs
get_enviroment_type() :: String.t()
Should return "dev" or "prod". All other values will generate problems.