2019-01-13 09:37:44 -06:00
|
|
|
let shared = import "shared.ucg";
|
2018-08-13 23:11:35 -05:00
|
|
|
|
2017-12-24 15:24:06 -05:00
|
|
|
// A few constants.
|
2017-11-26 12:22:58 -05:00
|
|
|
let dbhost1 = "db1.prod.net";
|
|
|
|
let dbhost2 = "db2.prod.net";
|
2017-08-12 14:48:28 -05:00
|
|
|
let dbname = "testdb";
|
|
|
|
|
2017-12-24 15:24:06 -05:00
|
|
|
// Constructor for database connection strings.
|
2019-01-24 20:04:40 -06:00
|
|
|
let mk_db_conn = func (host, port, db) => {
|
2017-08-12 14:48:28 -05:00
|
|
|
host = host,
|
|
|
|
port = port,
|
|
|
|
db = db,
|
2017-11-15 22:41:55 -06:00
|
|
|
conn_string = "@:@/@" % (host, port, db)
|
2017-08-12 14:48:28 -05:00
|
|
|
};
|
|
|
|
|
2018-08-13 23:11:35 -05:00
|
|
|
let db_conn1 = mk_db_conn(dbhost1, shared.port, dbname);
|
|
|
|
let db_conn2 = mk_db_conn(dbhost2, shared.port, dbname);
|
2017-11-26 12:22:58 -05:00
|
|
|
|
2017-12-24 15:24:06 -05:00
|
|
|
// We have two database connections in a list
|
2018-03-15 19:08:33 -05:00
|
|
|
let db_conn_list = [db_conn1, db_conn2];
|
|
|
|
|
2019-01-24 20:04:40 -06:00
|
|
|
let connstr_mapper = func (item) => {
|
2018-03-15 19:08:33 -05:00
|
|
|
str = item.conn_string
|
|
|
|
};
|
|
|
|
|
2019-06-20 19:42:23 -05:00
|
|
|
let db_conns = map(connstr_mapper, [db_conn1, db_conn2]);
|
2017-08-12 14:48:28 -05:00
|
|
|
|
2018-07-02 18:30:17 -05:00
|
|
|
let cplx_list = [
|
|
|
|
{foo = 1},
|
|
|
|
{bar = {foo=1}},
|
|
|
|
];
|
|
|
|
|
2017-12-24 15:24:06 -05:00
|
|
|
// Our server configuration.
|
2017-08-12 14:48:28 -05:00
|
|
|
let server_config = {
|
2018-02-02 15:27:33 -06:00
|
|
|
db_conn1 = db_conns.0, // connection one
|
2017-11-26 13:08:47 -06:00
|
|
|
db_conn2 = db_conns.1,
|
2018-03-06 19:39:10 -06:00
|
|
|
tmpldir = "./templates",
|
|
|
|
prefix = {
|
|
|
|
foo = "bar"
|
2018-03-15 19:31:02 -05:00
|
|
|
},
|
|
|
|
l = ["foo", "bar"]
|
2018-08-15 18:22:05 -05:00
|
|
|
};
|
|
|
|
|
2018-08-17 17:38:49 -05:00
|
|
|
out json server_config;
|