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

[Bug]: step-ca does not detect when it's not in an interactive shell, sends escape codes for colours regardless #1549

Closed
cricalix opened this issue Sep 24, 2023 · 4 comments
Labels
bug needs triage Waiting for discussion / prioritization by team

Comments

@cricalix
Copy link

Steps to Reproduce

Run step-ca docker image on something like a Synology NAS, which provides a web UI to review the logs.

image

Your Environment

  • OS - Synology host, Docker image pulled as :latest on 2023-09-23
  • step-ca Version - 24.2

Expected Behavior

step-ca detects that stdout is not interactive, strips colour codes from output.

Actual Behavior

step-ca does not detect that stdout is not interactive, includes colour codes, making logs very hard to read

Additional Context

I can work around the problem by setting up the NAS with SSH and using docker logs, but it'd still be nice if the step-ca binary accepted an environment variable to control emitting colours; I could then configure the docker env variables to set that variable.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@cricalix cricalix added bug needs triage Waiting for discussion / prioritization by team labels Sep 24, 2023
maraino added a commit that referenced this issue Sep 26, 2023
This commit adds support for NO_COLOR environment variable, if this is
set, colors will be disabled in the logrus text formatter.

This commit also adds support for the environment variables supported by
logrus, CLICOLOR and CLICOLOR_FORCE

Related to #1549
@maraino
Copy link
Contributor

maraino commented Sep 26, 2023

Hi @cricalix, I'm not able to reproduce this, on my docker the terminal is properly NOT detected and colors are disabled, but I've added support for the NO_COLOR environment variable here #1559

@maraino
Copy link
Contributor

maraino commented Sep 26, 2023

Fixed by #1559. Now the environment variable NO_COLOR can be set to disable colors.

@maraino maraino closed this as completed Sep 26, 2023
@cricalix
Copy link
Author

Thank you @maraino . It's possible that Synology's docker integration is a bit weird, and pretends to be a tty, but with NO_COLOR support I can at least pass that through once the docker image gets your patch.

@maraino
Copy link
Contributor

maraino commented Sep 29, 2023

Thank you @maraino . It's possible that Synology's docker integration is a bit weird, and pretends to be a tty, but with NO_COLOR support I can at least pass that through once the docker image gets your patch.

It should be already in smallstep/step-ca:0.25.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage Waiting for discussion / prioritization by team
Projects
None yet
Development

No branches or pull requests

2 participants