drab v0.8.3 Drab.Config
Drab configuration related functions.
Configuration options:
Mandatory
:main_phoenix_app
A name of your Phoenix application (atom). If it is not set, Drab tries to guess it from
mix.exs
.
Must be set when not using Mix
.
Optional
:access_session (default: [])
Keys of the session map, which will be included to the Drab Session globally, usually
:user_id
, etc. See Drab.Commander.access_session/1
for more.
:browser_response_timeout (default: 5000)
Timeout, after which all functions querying/updating browser UI will give up; integer in
milliseconds, or :infinity
.
:disable_controls_while_processing (default: true
)
After sending request to the server, sender object will be disabled until it gets the answer. Warning: this behaviour is not broadcasted, so only the control in the current browser is going to be disabled.
:disable_controls_when_disconnected (default: true
)
Shall controls be disabled when there is no connectivity between the browser and the server?
:default_encoder (default: Drab.Coder.Cipher)
Sets the default encoder/decoder for the various functions, like Drab.Browser.set_cookie/3
:drab_store_storage (default: :session_storage)
Where to keep the Drab Store - :memory
, :local_storage
or :session_storage
. Data in
the memory is kept to the next page load, session storage persist until browser (or a tab)
is closed, local storage is kept forever.
:enable_live_scripts (default: false
)
Re-evaluation of JavaScripts containing living assigns is disabled by default.
:endpoint
Endpoint module name of your Web Application.
:events_to_disable_while_processing (default: ["click"]
)
Controls with those Drab events will be disabled when waiting for server response.
:events_shorthands (default: ["click", "change", "keyup", "keydown"]
)
The list of the shorthand attributes to be used in drab-controlled DOM object, ie:
<drab-click="handler">
. Please keep the list small, as it affects the client JS performance.
:js_socket_constructor, (default: “require(“phoenix”).Socket”)
Javascript constructor for the Socket; more info in Drab.Client.
:live_conn_pass_through, (default: %{private: %{phoenix_endpoint: true}}
)
A deep map marking fields which should be preserved in the fake @conn
assign. See Drab.Live
for more detailed explanation on conn case.
:phoenix_channel_options (default: [])
An options passed to use Phoenix.Channel
, for example: [log_handle_in: false]
.
:presence (default: false)
Runs the Drab.Presence
server. Defaults to false to avoid unnecessary load. See
Drab.Presence
for more information.
:pubsub
PubSub module name.
:socket (default: "/socket"
)
Path to the socket on which Drab operates.
:templates_path (default: “priv/templates/drab”)
Path to the user-defined Drab templates (not to be confused with Phoenix application templates,
these are to be used internally, see Drab.Modal
for the example usage). Must start with
“priv/“.
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
Returns any config key for current main Application
iex> Drab.Config.app_config(:secret_key_base) |> String.length()
64
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
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)
"priv/custom_templates"
All the config values may be override in config.exs
, for example:
config :drab, disable_controls_while_processing: false
Returns the PubSub module of the client Phoenix Application
iex> Drab.Config.pubsub()
DrabTestApp.PubSub