Add Kinetic to ChicagoBoss App

161 views Asked by At

I am looking to add Kinetic to my chicago boss app, I have added the kinetic library to the deps directory within my chicago boss app. When I run the erlang shell from within the kinetic directory I have a development.config in the root of the kinetic directory that looks like the below:

[{kinetic,
    [{args, [
        % All of these values are optional
        % kinetic will get all of the context from the instance
        {region, "us-east-1"},
        {aws_access_key_id, "AKAAAAAABABABA"},
        {aws_secret_access_key, "3/Fx9987sxc352728181892838bhbjkd"},
        {iam_role, "kinetic"},

        {lhttpc_opts, [{max_connections, 5000}]}
    ]}]
}].

when I start the chicago boss app and run a kinetic command Im getting an invalid credentials error so it seems the kinetic library loaded properly but not the constants for my aws keys...Any idea how to do this in chicago boss?

Thanks!

1

There are 1 answers

11
Łukasz Ptaszyński On BEST ANSWER

Solution

Just paste your tuple {kinetic, [...]} from development.config to boss.config which contains list of configurations for your erlang applications.

More general about configuration files

In each application which depends on configuration we can see code like application:get_env(App, Key) or application:get_env(App, Key, SomeDefault). It's in fact call to application_controller which briefly manages application loading/unloading/starting/stoping and keeps informations about it. You can check how much it knows with io:format("~n~p~n",[ets:tab2list(ac_tab)]). These are mostly taken from .app files in ebin/ directory which are mostly generated by rebar from app.src in src/ during compilation.

The most interesting key for us in .app.src is env which should contain default configuration for application which will be loaded as first and then some of those values will be overridden by your system config which is now boss.config.

When you were playing with kinetic in it's development environment you were starting it by erl -pa ebin -pa deps/*/ebin -s inets -s crypto -s ssl -s lhttpc -config development -s kinetic with -config you passed your system config and overridde default environment values which in this case are not specified and defaults are resolved after application is started in kinetic_config.erl but look at lager.app.src and compare it to one within your boss.config. Now you see how to tweak it. Let's start with colouring logs ;)

From official documentation: Configuring an Application and config