drab v0.5.6 Drab.Config

Drab configuration related functions.

Link to this section Summary

Functions

Returns the config for current main Application

Returns any config key for current main Application

Returns all environment for the default main Application

Returns the Phoenix Application module atom

Returns the name of the client Phoenix Application

Returns configured Drab.Live.Engine Extension. String with dot at the begin

Returns the Endpoint of the client Phoenix Application

Returns Drab configuration for the given atom

Returns the PubSub module of the client Phoenix Application

Link to this section Functions

Returns the config for current main Application

iex> is_list(Drab.Config.app_config())
true
Link to this function app_config(config_key)

Returns any config key for current main Application

iex> Drab.app_config(:secret_key_base)
"bP1ZF+DDZiAVGuIixHSboET1g18BPO4HeZnggJA/7q"

Returns all environment for the default main Application

iex> is_list(Drab.Config.app_config())
true

Returns the Phoenix Application module atom

iex> Drab.Config.app_module()
DrabTestApp

Returns the name of the client Phoenix Application

iex> Drab.Config.app_name()
:drab
Link to this function drab_extension()

Returns configured Drab.Live.Engine Extension. String with dot at the begin.

Example, for config:

config :phoenix, :template_engines,
  drab: Drab.Live.Engine

it will return “.drab”

iex> Drab.Config.drab_extension()
".drab"

Returns the Endpoint of the client Phoenix Application

iex> Drab.Config.endpoint()  
DrabTestApp.Endpoint

Returns Drab configuration for the given atom.

iex> Drab.Config.get(:templates_path)
"test/support/priv/templates/drab"

All the config values may be override in config.exs, for example:

config :drab, disable_controls_while_processing: false

Configuration options:

  • templates_path (default: “priv/templates/drab”) - path to the user templates (may be new or override default templates)
  • disable_controls_while_processing (default: true) - after sending request to the server, sender will be disabled until get the answer; warning: this behaviour is not broadcasted, so only the control in the current browers will be disabled
  • events_to_disable_while_processing (default: ["click"]) - list of events which will be disabled when waiting for server response
  • disable_controls_when_disconnected (default: true) - disables control when there is no connectivity between the browser and the server
  • socket (default: "/socket") - path to the socket where Drab operates
  • drab_store_storage (default: :session_storage) - where to keep the Drab Store - :memory, :local_storage or :session_storage; data in memory is kept to the next page load, session storage persist until browser (or a tab) is closed, and local storage is kept forever
  • browser_response_timeout - timeout, after which all functions querying/updating browser UI will give up; integer in milliseconds or :infinity
  • main_phoenix_app - a name of your Phoenix application (atom); if not set it gets it from the mix.exs

Returns the PubSub module of the client Phoenix Application

iex> Drab.Config.pubsub()  
DrabTestApp.PubSub