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

configcat flag-v2 value show --json returns an empty object #31

Closed
oshaughnessy opened this issue Aug 21, 2024 · 4 comments
Closed

configcat flag-v2 value show --json returns an empty object #31

oshaughnessy opened this issue Aug 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@oshaughnessy
Copy link

Describe the bug

Running configcat flag-v2 value show --json, whether or not a flag-id is given, produces an empty result.

To reproduce

$ configcat flag-v2 value show --flag-id _some_id_ --json
{}

Expected behavior

A JSON object with data about the state of the flag in each environment, similar to the report-style output that is provided without the --json flag.

@oshaughnessy oshaughnessy added the bug Something isn't working label Aug 21, 2024
@z4kn4fein
Copy link
Member

Hi @oshaughnessy, thank you for reporting this issue! I'm going to investigate what's happening and I'll let you know when the fix is released.

@oshaughnessy
Copy link
Author

oshaughnessy commented Aug 22, 2024

I'm sure you'll have a fix out quick, but if anybody else needs a workaround, this does the trick in bash to extract a specific field (in my case, the value for a given environment):

function cc_get_env_flag
{
    local _env_name=$1
    local _flag_id=$2
    export _env_name
    configcat flag-v2 value show --flag-id $_flag_id --non-interactive |awk '/^----/ { MATCH=0 } $2==ENVIRON["_env_name"] { MATCH=1 } $2=="Default:" && MATCH==1 { RESULT=$3 } END { print RESULT }'
    export -n _env_name
}

Then pass it your environment name and flag ID, e.g.

flag_val=$(cc_get_env_flag dev 123456)
echo $flag_val

@z4kn4fein z4kn4fein reopened this Aug 22, 2024
@z4kn4fein
Copy link
Member

z4kn4fein commented Aug 22, 2024

Hey @oshaughnessy, I've released v2.3.3 with the fix, could you please verify that it works now as you expected? Thanks!

@oshaughnessy
Copy link
Author

That looks great. Thank you!

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

2 participants