View Source erf_conf (erf v0.1.2)

erf's configuration manager module.

Summary

Functions

Clears the configuration for the given Name.
Returns the configuration for the given Name.
Returns the log level for the given Name.
Returns the postprocess middlewares for the given Name.
Returns the preprocess middlewares for the given Name.
Returns a mapping between the routes and their matching RegEx for a given Name.
Returns the router for the given Name.
Returns the router module name for the given Name.
Sets the configuration for the given Name.

Types

-type t() ::
          #{callback => module(),
            log_level => logger:level(),
            preprocess_middlewares => [module()],
            postprocess_middlewares => [module()],
            route_patterns => erf:route_patterns(),
            router => erl_syntax:syntaxTree(),
            router_mod => module(),
            spec_path => binary(),
            spec_parser => module(),
            static_routes => [erf:static_route()],
            swagger_ui => boolean()}.

Functions

-spec clear(Name) -> Result when Name :: atom(), Result :: ok.
Clears the configuration for the given Name.
-spec get(Name) -> Result when Name :: atom(), Result :: {ok, Conf} | {error, not_found}, Conf :: t().
Returns the configuration for the given Name.
-spec log_level(Name) -> Result
                   when
                       Name :: atom(),
                       Result :: {ok, LogLevel} | {error, not_found},
                       LogLevel :: logger:level().
Returns the log level for the given Name.
Link to this function

postprocess_middlewares(Name)

View Source
-spec postprocess_middlewares(Name) -> Result
                                 when
                                     Name :: atom(),
                                     Result :: {ok, PostprocessMiddlewares} | {error, not_found},
                                     PostprocessMiddlewares :: [module()].
Returns the postprocess middlewares for the given Name.
Link to this function

preprocess_middlewares(Name)

View Source
-spec preprocess_middlewares(Name) -> Result
                                when
                                    Name :: atom(),
                                    Result :: {ok, PreprocessMiddlewares} | {error, not_found},
                                    PreprocessMiddlewares :: [module()].
Returns the preprocess middlewares for the given Name.
-spec route_patterns(Name) -> Result
                        when
                            Name :: atom(),
                            Result :: {ok, RoutePatterns} | {error, not_found},
                            RoutePatterns :: erf:route_patterns().
Returns a mapping between the routes and their matching RegEx for a given Name.
-spec router(Name) -> Result
                when
                    Name :: atom(),
                    Result :: {ok, Router} | {error, not_found},
                    Router :: erl_syntax:syntaxTree().
Returns the router for the given Name.
-spec router_mod(Name) -> Result
                    when
                        Name :: atom(),
                        Result :: {ok, RouterMod} | {error, not_found},
                        RouterMod :: module().
Returns the router module name for the given Name.
-spec set(Name, Conf) -> Result when Name :: atom(), Conf :: t(), Result :: ok.
Sets the configuration for the given Name.