Add a way to set arbitrary data accessible by all tasks. Use it to allow autologin for testing multiple instances more easily.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3689 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-12-01 23:29:53 +00:00
parent 00c1ec660e
commit 84a3d7348d
4 changed files with 42 additions and 2 deletions

View File

@ -306,6 +306,7 @@ typedef struct tf_run_args_t {
const char* db_path;
const char* secrets_path;
int count;
const char* args;
bool help;
} tf_run_args_t;
@ -324,6 +325,7 @@ static int _tf_run_task(const tf_run_args_t* args, int index)
tf_task_set_ssb_port(task, args->ssb_port ? args->ssb_port + index : 0);
tf_task_set_http_port(task, args->http_port ? args->http_port + index : 0);
tf_task_set_https_port(task, args->https_port ? args->https_port + index : 0);
tf_task_set_args(task, args->args);
const char* db_path = args->db_path;
const char* secrets_path = args->secrets_path;
char db_path_buffer[256];
@ -363,6 +365,7 @@ static int _tf_command_run(const char* file, int argc, char* argv[])
{ "db-path", 'd', offsetof(tf_run_args_t, db_path), NULL, XOPT_TYPE_STRING, NULL, "Sqlite database path (default: db.sqlite)." },
{ "secrets-path", 'i', offsetof(tf_run_args_t, secrets_path), NULL, XOPT_TYPE_STRING, NULL, "Secrets/identity path." },
{ "count", 'n', offsetof(tf_run_args_t, count), NULL, XOPT_TYPE_INT, NULL, "Number of instances to run." },
{ "args", 'a', offsetof(tf_run_args_t, args), NULL, XOPT_TYPE_STRING, NULL, "Arguments of the form key=value,foo=bar,verbose=true." },
{ "help", 'h', offsetof(tf_run_args_t, help), NULL, XOPT_TYPE_BOOL, NULL, "Shows this help message." },
XOPT_NULLOPTION,
};