Repository: meltano/meltano

Issue:
feature:  Set the meltano.yml path in a directory different from the project 
### Feature scope

Configuration (settings parsing, validation, etc.)

### Description

I really tried to make a docker container with meltano to run in AWS Lambda, but I had a lot of problems because in my case I needed to change meltano.yml in run time, but only possible to change files in AWS Lambda if this file is in /tmp.

I believe could be a great feature if it is possible to set meltano.yml path by a environment variable. I tried to change this meltano source code but I had problems with the plugins installations. These changes are beyond my skills. 

So I propose this new feature like other projects have (DBT as an example), where it is possible set a new configuration file or set a path for the configuration file.


Discussion:
Hi @leandroimail, thanks for logging an issue!

There's `--cwd`:

```console
$ meltano --cwd /path/to/project/root ...
```

Which lets you point to a _project directory_ that contains a `meltano.yml` file.

It's a global CLI option, but it's not documented in https://docs.meltano.com/reference/command-line-interface#global-configuration. It probably should, if you're still interested in contributing 😉.
@edgarrmondragon can I work on this?
> @edgarrmondragon can I work on this?

Sure! This merely needs documentation so you may want to make changes in https://github.com/meltano/meltano/tree/b26b9bfffa37e89a168dabffb4ef625a1c91fcf7/docs.

Resolving patch:
diff --git a/src/meltano/cli/add.py b/src/meltano/cli/add.py
--- a/src/meltano/cli/add.py
+++ b/src/meltano/cli/add.py
@@ -102,6 +102,11 @@ def _load_yaml_from_ref(_ctx, _param, value: str | None) -> dict:
     is_flag=True,
     help="Do not install the plugin after adding it to the project.",
 )
+@click.option(
+    "--force-install",
+    is_flag=True,
+    help="Ignore the required Python version declared by the plugins.",
+)
 @pass_project()
 @click.pass_context
 def add(  # noqa: WPS238
@@ -187,7 +192,12 @@ def add(  # noqa: WPS238
     tracker.track_command_event(CliEvent.inflight)
 
     if not flags.get("no_install"):
-        success = install_plugins(project, plugins, reason=PluginInstallReason.ADD)
+        success = install_plugins(
+            project,
+            plugins,
+            reason=PluginInstallReason.ADD,
+            force=flags.get("force_install", False),
+        )
 
         if not success:
             tracker.track_command_event(CliEvent.failed)


Test patch:
diff --git a/tests/meltano/cli/test_add.py b/tests/meltano/cli/test_add.py
--- a/tests/meltano/cli/test_add.py
+++ b/tests/meltano/cli/test_add.py
@@ -160,6 +160,7 @@ def test_add_multiple(self, project: Project, cli_runner):
                 project,
                 [tap_gitlab, tap_adwords, tap_facebook],
                 reason=PluginInstallReason.ADD,
+                force=False,
             )
 
     @pytest.mark.order(1)
@@ -477,6 +478,7 @@ def test_add_custom(self, project: Project, cli_runner):
                 project,
                 [plugin],
                 reason=PluginInstallReason.ADD,
+                force=False,
             )
 
     def test_add_custom_no_install(self, project: Project, cli_runner):
@@ -526,6 +528,7 @@ def test_add_custom_no_install(self, project: Project, cli_runner):
                 project,
                 [plugin],
                 reason=PluginInstallReason.ADD,
+                force=False,
             )
 
     def test_add_custom_variant(self, project: Project, cli_runner):
@@ -793,3 +796,24 @@ def test_add_with_python_version(self, cli_runner: CliRunner):
                 ),
             )
             venv_mock.assert_called_once_with(python)
+
+    def test_add_with_force_flag(self, project: Project, cli_runner: CliRunner):
+        with mock.patch("meltano.cli.add.install_plugins") as install_plugin_mock:
+            install_plugin_mock.return_value = True
+            res = cli_runner.invoke(
+                cli,
+                ["add", "extractor", "tap-gitlab", "--force-install"],
+            )
+            tap_gitlab = project.plugins.find_plugin(
+                "tap-gitlab",
+                PluginType.EXTRACTORS,
+            )
+
+        assert_cli_runner(res)
+        assert tap_gitlab
+        install_plugin_mock.assert_called_once_with(
+            project,
+            [tap_gitlab],
+            reason=PluginInstallReason.ADD,
+            force=True,
+        )