summaryrefslogtreecommitdiff
path: root/priv/config/rvi_backend.config
blob: 8e5ec378a1ab22e5f652941d896fc2239aef980e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
%% -*- erlang -*-

%% Copyright (C) 2014, Jaguar Land Rover
%%
%% This program is licensed under the terms and conditions of the
%% Mozilla Public License, version 2.0.  The full text of the
%% Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
%%
%% Configuration file for the (in-vehicle) IVI used by the hvac_demo
%%
%% See ../hvac_demo/README.md for details on the demo.
%%
%% See ../CONFIGURE.md for a details on the configuration process
%% itself.
%%

%% Parameters for simpler modification
Env = fun(V, Def) ->
	      case os:getenv(V) of
		  false -> Def;
		  Str when is_integer(Def) -> list_to_integer(Str);
		  Str when is_atom(Def) -> list_to_atom(Str);
		  Str -> Str
	      end
      end.
MyPort = Env("RVI_MYPORT", 8800).
MyIP = Env("RVI_MYIP", "38.129.64.31").
IPPort = fun(IP, Port) ->
		 IP ++ ":" ++ integer_to_list(Port)
	 end.
LogLevel = Env("RVI_LOGLEVEL", notice).

[
 %% All erlang apps needed to fire up a node. Do not touch.
 {include_lib, "rvi_core/priv/config/rvi_common.config"},

 %%
 %% Custom environment settings
 %% for all apps running on the node.
 %%
 {env,
  [
   {rvi_core,
    [
     { node_address, IPPort(MyIP, MyPort+7) },

     { node_service_prefix, "genivi.org/backend"},

     { routing_rules,
       [
	{ "",
	  [
	   { proto_json_rpc, dlink_tcp_rpc}
	  ]
	}
       ]
     },
     { components,
       [
	{service_edge,
	  [
	    %% Service_edge_rpc component is used as a gen_server
	    { service_edge_rpc, gen_server,
	    [
	     { json_rpc_address, { MyIP, MyPort+1 } },
	     { msgpack_rpc, [{ ip, MyIP },
			     { port, MyPort+21 } ] },
	     { websocket, [ { port, MyPort+8 } ] }
	    ]
	    }
	  ]
	},
	{ rvi_common, [{ rvi_log, gen_server, [{json_rpc_address, MyPort+9}]}]},
	{ service_discovery, [ { service_discovery_rpc, gen_server, [] } ] },
	{ schedule,          [  { schedule_rpc,         gen_server, [] } ] },
	{ authorize,         [ { authorize_rpc,         gen_server, [] } ] },
	{ protocol,          [ { proto_json_rpc,        gen_server, [] } ] },
	{ data_link,
	  [
	    { dlink_tcp_rpc, gen_server,
	      [
		{ server_opts, [ { port, MyPort + 7 }]}
	      ]
	    },
	   { dlink_tls_rpc, gen_server,
	     [
	      { server_opts, [ {port, MyPort + 10} ]}
	     ]
	   }
	  ]
	}
       ]
     }
    ]}
  ]}
].