Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to override disabled option #177

Open
Invizory opened this issue Apr 18, 2024 · 5 comments
Open

Unable to override disabled option #177

Invizory opened this issue Apr 18, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Invizory
Copy link

Invizory commented Apr 18, 2024

Defect

“Adding and overriding configuration” section in the documentation states:

For single-value options like command, working_dir or disabled, the new value replaces the old value.

However, the old value of disabled is not actually replaced if the new value is false.

Version of process-compose:

1.2.0

OS environment:

Ubuntu 22.04.4 LTS

Steps or code to reproduce the issue:

process-compose.yml:

version: "0.5"
processes:
  test:
    disabled: true
    command: echo foo

process-compose.override.yml:

processes:
  test:
    disabled: false
    command: echo bar

Run process-compose run test.

Expected result:

bar

Actual result:

@F1bonacc1
Copy link
Owner

Hi @Invizory,

This is the expected behavior.
See: darccio/mergo#24 (comment)

@F1bonacc1 F1bonacc1 added the wontfix This will not be worked on label Apr 22, 2024
@raszi
Copy link

raszi commented Dec 5, 2024

I understand that the underlying library works like that, but then how can I re-enable a service that was disabled in an override file?

@thenonameguy
Copy link
Contributor

thenonameguy commented Dec 5, 2024

We hacked around the problem with environment variable substitution:

disabled: ${SOME_ENV_VAR}

@F1bonacc1
Copy link
Owner

I see that some additional comments were added to that thread.
I will reopen this issue, maybe something can be done here after all.

Another temporary workaround can be using vars in your command:

vars:
LOCATION: USA
FTR_A_ENABLED: true
FTR_B_ENABLED: true
command: "echo 'Hi {{or .HI 123 }} from {{.LOCATION}} version {{or \"${VERSION}\" .VERSION}} {{if and .FTR_A_ENABLED .FTR_B_ENABLED}}Not Supported{{end}}'"

@F1bonacc1 F1bonacc1 reopened this Dec 5, 2024
@raszi
Copy link

raszi commented Dec 5, 2024

In the end, we succeeded with the env var substitution as @thenonameguy wrote, but we needed to disable the strict mode because a disabled service was complaining about another disabled dependency of it.

@F1bonacc1 F1bonacc1 added bug Something isn't working and removed wontfix This will not be worked on labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants