mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
The build and validate commands now take a list of files to process. The outputs for files that specify the are given the same name as the containing file with the extension changed to the extension that the converter specifies.
44 lines
961 B
Plaintext
44 lines
961 B
Plaintext
import "shared.ucg" as shared;
|
|
|
|
// A few constants.
|
|
let dbhost1 = "db1.prod.net";
|
|
let dbhost2 = "db2.prod.net";
|
|
let dbname = "testdb";
|
|
|
|
// Constructor for database connection strings.
|
|
let mk_db_conn = macro (host, port, db) => {
|
|
host = host,
|
|
port = port,
|
|
db = db,
|
|
conn_string = "@:@/@" % (host, port, db)
|
|
};
|
|
|
|
let db_conn1 = mk_db_conn(dbhost1, shared.port, dbname);
|
|
let db_conn2 = mk_db_conn(dbhost2, shared.port, dbname);
|
|
|
|
// We have two database connections in a list
|
|
let db_conn_list = [db_conn1, db_conn2];
|
|
|
|
let connstr_mapper = macro (item) => {
|
|
str = item.conn_string
|
|
};
|
|
|
|
let db_conns = map connstr_mapper.str [db_conn1, db_conn2];
|
|
|
|
let cplx_list = [
|
|
{foo = 1},
|
|
{bar = {foo=1}},
|
|
];
|
|
|
|
// Our server configuration.
|
|
let server_config = {
|
|
db_conn1 = db_conns.0, // connection one
|
|
db_conn2 = db_conns.1,
|
|
tmpldir = "./templates",
|
|
prefix = {
|
|
foo = "bar"
|
|
},
|
|
l = ["foo", "bar"]
|
|
};
|
|
|
|
out json server_config; |