orber_env.erl
来自「OTP是开放电信平台的简称」· ERL 代码 · 共 1,444 行 · 第 1/4 页
ERL
1,444 行
end.get_debug_level() -> case application:get_env(orber, orber_debug_level) of {ok, Level} when integer(Level) -> Level; _ -> 0 end.%%-----------------------------------------------------------------%% Interceptor opertaions (see orber_pi.erl)%%-----------------------------------------------------------------get_interceptors() -> case application:get_env(orber, interceptors) of {ok, {native, PIs}} when list(PIs) -> {native, PIs}; {ok, {portable, PIs}} when list(PIs) -> {portable, PIs}; _ -> false end.get_local_interceptors() -> case application:get_env(orber, local_interceptors) of {ok, {native, PIs}} when list(PIs) -> {native, PIs}; {ok, {portable, PIs}} when list(PIs) -> {portable, PIs}; _ -> false end.get_cached_interceptors() -> case get(oe_orber_interceptor_cache) of undefined -> PIs = case application:get_env(orber, local_interceptors) of {ok, {native, LPIs}} when list(LPIs) -> {native, LPIs}; {ok, {portable, LPIs}} when list(LPIs) -> {portable, LPIs}; _ -> get_interceptors() end, put(oe_orber_interceptor_cache, PIs), PIs; PIs -> PIs end.set_interceptors({Type, InterceptorList}) when list(InterceptorList) -> configure(interceptors, {Type, InterceptorList});set_interceptors(_) -> exit({error, "Usage: {Type, ModuleList}"}).%%-----------------------------------------------------------------%% Light weight Orber operations%%-----------------------------------------------------------------is_lightweight() -> case application:get_env(orber, lightweight) of {ok, L} when list(L) -> true; _ -> false end.get_lightweight_nodes() -> case application:get_env(orber, lightweight) of {ok, L} when list(L) -> L; _ -> false end. %%-----------------------------------------------------------------%% Security access operations (SSL)%%-----------------------------------------------------------------secure() -> case application:get_env(orber, secure) of {ok, V} -> V; _ -> no end. iiop_ssl_ip_address_local() -> case application:get_env(orber, iiop_ssl_ip_address_local) of {ok,I} when list(I) -> [I]; _ -> [] end.iiop_ssl_backlog() -> case application:get_env(orber, iiop_ssl_backlog) of {ok, Int} when integer(Int), Int >= 0 -> Int; _ -> 5 end.iiop_ssl_in_keepalive() -> case application:get_env(orber, iiop_ssl_in_keepalive) of {ok, true} -> true; _ -> false end.iiop_ssl_out_keepalive() -> case application:get_env(orber, iiop_ssl_out_keepalive) of {ok, true} -> true; _ -> false end.iiop_ssl_accept_timeout() -> case application:get_env(orber, iiop_ssl_accept_timeout) of {ok, N} when integer(N) -> N * 1000; _ -> infinity end. iiop_ssl_port() -> case application:get_env(orber, secure) of {ok, ssl} -> case application:get_env(orber, iiop_ssl_port) of {ok, Port} when integer(Port) -> Port; _ -> 4002 end; _ -> -1 end.nat_iiop_ssl_port() -> case application:get_env(orber, secure) of {ok, ssl} -> case application:get_env(orber, nat_iiop_ssl_port) of {ok, Port} when integer(Port), Port > 0 -> Port; {ok, {local, Default, _NATList}} -> Default; _ -> iiop_ssl_port() end; _ -> -1 end.nat_iiop_ssl_port(LocalPort) -> case application:get_env(orber, secure) of {ok, ssl} -> case application:get_env(orber, nat_iiop_ssl_port) of {ok, Port} when integer(Port), Port > 0 -> Port; {ok, {local, Default, NATList}} -> orber_tb:keysearch(LocalPort, NATList, Default); _ -> iiop_ssl_port() end; _ -> -1 end.ssl_server_certfile() -> case application:get_env(orber, ssl_server_certfile) of {ok, V1} when list(V1) -> V1; {ok, V2} when atom(V2) -> atom_to_list(V2); _ -> [] end. ssl_client_certfile() -> case get(ssl_client_certfile) of undefined -> case application:get_env(orber, ssl_client_certfile) of {ok, V1} when list(V1) -> V1; {ok, V2} when atom(V2) -> atom_to_list(V2); _ -> [] end; V -> V end.set_ssl_client_certfile(Value) when list(Value) -> put(ssl_client_certfile, Value). ssl_server_verify() -> Verify = case application:get_env(orber, ssl_server_verify) of {ok, V} when integer(V) -> V; _ -> 0 end, if Verify =< 2, Verify >= 0 -> Verify; true -> 0 end. ssl_client_verify() -> Verify = case get(ssl_client_verify) of undefined -> case application:get_env(orber, ssl_client_verify) of {ok, V1} when integer(V1) -> V1; _ -> 0 end; V2 -> V2 end, if Verify =< 2, Verify >= 0 -> Verify; true -> 0 end.set_ssl_client_verify(Value) when integer(Value), Value =< 2, Value >= 0 -> put(ssl_client_verify, Value), ok. ssl_server_depth() -> case application:get_env(orber, ssl_server_depth) of {ok, V1} when integer(V1) -> V1; _ -> 1 end. ssl_client_depth() -> case get(ssl_client_depth) of undefined -> case application:get_env(orber, ssl_client_depth) of {ok, V1} when integer(V1) -> V1; _ -> 1 end; V2 -> V2 end.set_ssl_client_depth(Value) when integer(Value) -> put(ssl_client_depth, Value), ok. ssl_server_cacertfile() -> case application:get_env(orber, ssl_server_cacertfile) of {ok, V1} when list(V1) -> V1; {ok, V2} when atom(V2) -> atom_to_list(V2); _ -> [] end. ssl_client_cacertfile() -> case get(ssl_client_cacertfile) of undefined -> case application:get_env(orber, ssl_client_cacertfile) of {ok, V1} when list(V1) -> V1; {ok, V2} when atom(V2) -> atom_to_list(V2); _ -> [] end; V3 -> V3 end.set_ssl_client_cacertfile(Value) when list(Value) -> put(ssl_client_cacertfile, Value), ok. ssl_client_password() -> case application:get_env(orber, ssl_client_password) of {ok, V1} when list(V1) -> V1; _ -> [] end.ssl_server_password() -> case application:get_env(orber, ssl_server_password) of {ok, V1} when list(V1) -> V1; _ -> [] end.ssl_client_keyfile() -> case application:get_env(orber, ssl_client_keyfile) of {ok, V1} when list(V1) -> V1; _ -> [] end.ssl_server_keyfile() -> case application:get_env(orber, ssl_server_keyfile) of {ok, V1} when list(V1) -> V1; _ -> [] end.ssl_client_ciphers() -> case application:get_env(orber, ssl_client_ciphers) of {ok, V1} when list(V1) -> V1; _ -> [] end.ssl_server_ciphers() -> case application:get_env(orber, ssl_server_ciphers) of {ok, V1} when list(V1) -> V1; _ -> [] end.ssl_client_cachetimeout() -> case application:get_env(orber, ssl_client_cachetimeout) of {ok, V1} when integer(V1) -> V1; _ -> infinity end.ssl_server_cachetimeout() -> case application:get_env(orber, ssl_server_cachetimeout) of {ok, V1} when integer(V1) -> V1; _ -> infinity end.%%-----------------------------------------------------------------%% function : configure%% Arguments: %% Returns : %% Exception: %% Effect :
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?