39 lines
1.1 KiB
Erlang
39 lines
1.1 KiB
Erlang
%%%-------------------------------------------------------------------
|
|
%% @doc efka public API
|
|
%% @end
|
|
%%%-------------------------------------------------------------------
|
|
|
|
-module(efka_app).
|
|
|
|
-behaviour(application).
|
|
|
|
-export([start/2, stop/1]).
|
|
|
|
start(_StartType, _StartArgs) ->
|
|
io:setopts([{encoding, unicode}]),
|
|
%% 启动mnesia数据库
|
|
start_mnesia(),
|
|
%% 加速内存的回收
|
|
erlang:system_flag(fullsweep_after, 16),
|
|
|
|
%% 仓库的基础url
|
|
application:set_env(efka, repository_url, "http://118.178.229.213:3000/anlicheng/ekfa/"),
|
|
|
|
efka_sup:start_link().
|
|
|
|
stop(_State) ->
|
|
ok.
|
|
|
|
%% internal functions
|
|
|
|
%% 启动内存数据库
|
|
start_mnesia() ->
|
|
%% 启动数据库
|
|
ok = mnesia:start(),
|
|
Tables = mnesia:system_info(tables),
|
|
lager:debug("[efka_app] tables: ~p", [Tables]),
|
|
%% 创建数据库表
|
|
not lists:member(id_generator, Tables) andalso id_generator_model:create_table(),
|
|
not lists:member(micro_service, Tables) andalso micro_service_model:create_table(),
|
|
not lists:member(micro_data, Tables) andalso micro_data_model:create_table(),
|
|
ok. |