Skip to content

feat: expose support links as env variables #11697

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

Merged
merged 4 commits into from
Jan 19, 2024
Merged

feat: expose support links as env variables #11697

merged 4 commits into from
Jan 19, 2024

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Jan 19, 2024

Fixes: #11628

This PR is a workaround to enable support links to be passed as env variables. This is an alternative solution to the proposed concept with enumerated vars (..._0_NAME, ..._1_NAME), which might be tricky to implement - discover the number of vars, guess the config schema, etc. JSON object seems to be more flexible format for such cases.

export CODER_SUPPORT_LINKS='[{"name": "Hello GitHub", "target": "https://github.com/coder/coder", "icon": "bug"}, {"name": "Hello Slack", "target": "https://codercom.slack.com/archives/C014JH42DBJ", "icon": "https://raw.githubusercontent.com/coder/coder/main/site/static/icon/slack.svg"}, {"name": "Hello Discord", "target": "https://discord.gg/coder", "icon": "https://raw.githubusercontent.com/coder/coder/main/site/static/icon/discord.svg"}, {"name": "Hello Foobar", "target": "https://discord.gg/coder", "icon": "/emojis/1f3e1.png"}]'

or

export CODER_SUPPORT_LINKS=$(cat <<EOF
[{"name": "Hello GitHub", "target": "https://github.com/coder/coder", "icon": "bug"},
 {"name": "Hello Slack", "target": "https://codercom.slack.com/archives/C014JH42DBJ", "icon": "https://raw.githubusercontent.com/coder/coder/main/site/static/icon/slack.svg"},
 {"name": "Hello Discord", "target": "https://discord.gg/coder", "icon": "https://raw.githubusercontent.com/coder/coder/main/site/static/icon/discord.svg"},
 {"name": "Hello Foobar", "target": "https://discord.gg/coder", "icon": "/emojis/1f3e1.png"}]
EOF
)

or in deployment.yaml

        env:
        - name: CODER_SUPPORT_LINKS
          value: >
            [{"name": "Hello GitHub", "target": "https://github.com/coder/coder", "icon": "bug"},
             {"name": "Hello Slack", "target": "https://codercom.slack.com/archives/C014JH42DBJ", "icon": "https://raw.githubusercontent.com/coder/coder/main/site/static/icon/slack.svg"},
             {"name": "Hello Discord", "target": "https://discord.gg/coder", "icon": "https://raw.githubusercontent.com/coder/coder/main/site/static/icon/discord.svg"},
             {"name": "Hello Foobar", "target": "https://discord.gg/coder", "icon": "/emojis/1f3e1.png"}]

@mtojek mtojek self-assigned this Jan 19, 2024
@mtojek mtojek marked this pull request as ready for review January 19, 2024 09:33
Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. I think it's a good enough workaround. What do you tink @ammario?

@mtojek
Copy link
Member Author

mtojek commented Jan 19, 2024

I don't mind supporting both options. There could be users who prefer JSON over enumerated format (_0_NAME, _1_NAME,...). I will merge this change, and we can iterate on the other option later.

@mtojek mtojek merged commit 89fd294 into main Jan 19, 2024
@mtojek mtojek deleted the 11628-fix-1 branch January 19, 2024 10:20
@github-actions github-actions bot locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support setting supportLinks as env variables
2 participants