nova (nova v0.13.7)

View Source

Interface module for nova

Summary

Functions

Detects the language Nova is running in. It checks for the presence of the Elixir and LFE modules, and returns the language.

Formats a stacktrace into a list of maps. Each map contains the module, function, arity, file, and line number of the function call.

Returns a proplist with all nova applications and their prefix. This function is useful when calulating dynamic routes.

Works as the regular application:get_env/3 but instead of giving a specific application we target the application that started nova.

Returns which environment nova is started in. This fetches the environment-variable in sys.config for Nova and returns the value found. Defaults to: dev

Returns the name of the main bw-application (The one that started everything)

Sets an environment variable for the main application.

Enables or disables stacktraces. This is a global setting and affects all requests. If stacktraces are enabled, nova will try to print a stacktrace when an exception is thrown.

Types

state/0

-type state() :: any().

Functions

detect_language()

-spec detect_language() -> elixir | lfe | erlang.

Detects the language Nova is running in. It checks for the presence of the Elixir and LFE modules, and returns the language.

format_stacktrace(Stacktrace)

-spec format_stacktrace(Stacktrace :: [{M :: atom(), F :: atom(), A :: integer(), Info :: list()}]) ->
                           [map()].

Formats a stacktrace into a list of maps. Each map contains the module, function, arity, file, and line number of the function call.

get_apps()

-spec get_apps() -> [{App :: atom(), Prefix :: list()}].

Returns a proplist with all nova applications and their prefix. This function is useful when calulating dynamic routes.

get_env(Parameter, Default)

-spec get_env(Parameter :: atom(), Default :: any()) -> term() | undefined.

Works as the regular application:get_env/3 but instead of giving a specific application we target the application that started nova.

get_environment()

-spec get_environment() -> any().

Returns which environment nova is started in. This fetches the environment-variable in sys.config for Nova and returns the value found. Defaults to: dev

get_main_app()

-spec get_main_app() -> {ok, Application :: atom()} | undefined.

Returns the name of the main bw-application (The one that started everything)

set_env(Key, Value)

-spec set_env(Key :: atom(), Value :: any()) -> ok | {error, main_app_not_found}.

Sets an environment variable for the main application.

use_stacktrace(Enable)

-spec use_stacktrace(Enable :: boolean()) -> ok.

Enables or disables stacktraces. This is a global setting and affects all requests. If stacktraces are enabled, nova will try to print a stacktrace when an exception is thrown.