summaryrefslogtreecommitdiff
path: root/dev/run
diff options
context:
space:
mode:
authorJoan Touzet <wohali@users.noreply.github.com>2020-10-09 11:50:25 -0400
committerGitHub <noreply@github.com>2020-10-09 11:50:25 -0400
commit6e6f1d4a97c8d9772c763c252fa2f0debbc1b106 (patch)
treeab8aef68235ae042ca6954786ee152ee147649b2 /dev/run
parentb9f1336fe026aa2be45a9ceb529227a2ef13c87a (diff)
parent2b215079ed7130ab741ad3e29d3b674dd9395b52 (diff)
downloadcouchdb-test-PR.tar.gz
Merge branch 'main' into test-PRtest-PR
Diffstat (limited to 'dev/run')
-rwxr-xr-xdev/run41
1 files changed, 39 insertions, 2 deletions
diff --git a/dev/run b/dev/run
index a96817d83..d620e21cd 100755
--- a/dev/run
+++ b/dev/run
@@ -186,6 +186,12 @@ def get_args_parser():
help="Optional key=val config overrides. Can be repeated",
)
parser.add_option(
+ "--erlang-config",
+ dest="erlang_config",
+ default="rel/files/sys.config",
+ help="Specify an alternative Erlang application configuration"
+ )
+ parser.add_option(
"--degrade-cluster",
dest="degrade_cluster",
type=int,
@@ -211,6 +217,14 @@ def get_args_parser():
default=None,
help="Extra arguments to pass to beam process",
)
+ parser.add_option(
+ "-l",
+ "--locald-config",
+ dest="locald_configs",
+ action="append",
+ default=[],
+ help="Path to config to place in 'local.d'. Can be repeated",
+ )
return parser
@@ -233,11 +247,13 @@ def setup_context(opts, args):
"haproxy": opts.haproxy,
"haproxy_port": opts.haproxy_port,
"config_overrides": opts.config_overrides,
+ "erlang_config": opts.erlang_config,
"no_eval": opts.no_eval,
"extra_args": opts.extra_args,
"reset_logs": True,
"procs": [],
"auto_ports": opts.auto_ports,
+ "locald_configs": opts.locald_configs,
}
@@ -279,9 +295,24 @@ def setup_configs(ctx):
"_default": "",
}
write_config(ctx, node, env)
+ write_locald_configs(ctx, node, env)
generate_haproxy_config(ctx)
+def write_locald_configs(ctx, node, env):
+ for locald_config in ctx["locald_configs"]:
+ config_src = os.path.join(ctx["rootdir"], locald_config)
+ if os.path.exists(config_src):
+ config_filename = os.path.basename(config_src)
+ config_tgt = os.path.join(
+ ctx["devdir"], "lib", node, "etc", "local.d", config_filename
+ )
+ with open(config_src) as handle:
+ content = handle.read()
+ with open(config_tgt, "w") as handle:
+ handle.write(content)
+
+
def generate_haproxy_config(ctx):
haproxy_config = os.path.join(ctx["devdir"], "lib", "haproxy.cfg")
template = os.path.join(ctx["rootdir"], "rel", "haproxy.cfg")
@@ -382,6 +413,8 @@ def write_config(ctx, node, env):
with open(tgt, "w") as handle:
handle.write(content)
+ ensure_dir_exists(etc_tgt, "local.d")
+
def boot_haproxy(ctx):
if not ctx["with_haproxy"]:
@@ -401,7 +434,10 @@ def boot_haproxy(ctx):
def hack_default_ini(ctx, node, contents):
contents = re.sub(
- "^\[httpd\]$", "[httpd]\nenable = true", contents, flags=re.MULTILINE,
+ "^\[httpd\]$",
+ "[httpd]\nenable = true",
+ contents,
+ flags=re.MULTILINE,
)
if ctx["enable_erlang_views"]:
@@ -576,10 +612,11 @@ def boot_node(ctx, node):
"-args_file",
os.path.join(node_etcdir, "vm.args"),
"-config",
- os.path.join(reldir, "files", "sys"),
+ os.path.join(ctx["rootdir"], ctx["erlang_config"]),
"-couch_ini",
os.path.join(node_etcdir, "default.ini"),
os.path.join(node_etcdir, "local.ini"),
+ os.path.join(node_etcdir, "local.d"),
"-reltool_config",
os.path.join(reldir, "reltool.config"),
"-parent_pid",