docker: Enable WEBLATE_GITLAB_CREDENTIALS environment variable
Describe the problem
Right now it seems I can use gitlab_username and gitlab_token variables. But when I try to use gitlab_credentials:
WEBLATE_GITLAB_CREDENTIALS: "git.duniter.org": {username: weblate,token: XXXXXXXXXXXXXXX}
I get this error:
ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "./docker-compose.override.yml", line 17, column 52
Describe the solution you'd like
Add weblate_gitlab_credentials support
Describe alternatives you've considered
No response
Screenshots
No response
Additional context
No response
The error you get is from the docker-compose YAML parser, to have a valid YAML syntax it should be:
WEBLATE_GITLAB_CREDENTIALS: "git.duniter.org: username: XXXXXXXX,token: XXXXXXXXXXXXXXX"
Still, this setting is currently not parsed from the environment, see https://docs.weblate.org/en/latest/admin/install/docker.html#docker-environment-variables for list of supported variables (you can use WEBLATE_GITLAB_USERNAME and WEBLATE_GITLAB_TOKEN).
PS: Posting question to multiple places is not a good practice. This duplicates https://github.com/WeblateOrg/weblate/discussions/8128
This issue seems to be a good fit for newbie contributors. You are welcome to contribute to Weblate! Don't hesitate to ask any questions you would have while implementing this.
You can learn about how to get started in our contributors documentation.
I would like to work on this. Can you please assign this to me?
@jatinmark Yes, you're welcome.
You can now configure WEBLATE_GITLAB_CREDENTIALS for a single host by setting WEBLATE_GITLAB_HOST, WEBLATE_GITLAB_USERNAME and WEBLATE_GITLAB_TOKEN, see https://github.com/WeblateOrg/weblate/commit/b299b88af9dd20c6c8bef68ef1d5125def0de471. Multiple host configuration is still not supported via environment variables.
Has Jatin closed this issue or Is it still open? I can work on this
Yes , you can work on this issue .
Hello,
I would like to enable the WEBLATE_GITLAB_CREDENTIALS environment variable in the docker-compose.yml file. Currently, the file is not able to parse the value of this variable.
To fix the issue, I propose modifying the syntax of the WEBLATE_GITLAB_CREDENTIALS variable as follows:
environment:
DJANGO_SETTINGS_MODULE: weblate.settings_docker
WEBLATE_SITE_DOMAIN: ${WEBLATE_HOST}
# Enable the WEBLATE_GITLAB_CREDENTIALS variable here:
WEBLATE_GITLAB_CREDENTIALS: '"git.duniter.org": {username: $USERNAME,token: $TOKEN}'
Just to clarify it: There is currently no support for WEBLATE_GITLAB_CREDENTIALS in Docker. This issue is about adding it.
If you are configuring a single Gitlab instance, use WEBLATE_GITLAB_HOST, WEBLATE_GITLAB_USERNAME and WEBLATE_GITLAB_TOKEN.
Thank you for your report; the issue you have reported has just been fixed.
- In case you see a problem with the fix, please comment on this issue.
- In case you see a similar problem, please open a separate issue.
- If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.