weblate icon indicating copy to clipboard operation
weblate copied to clipboard

docker: Enable WEBLATE_GITLAB_CREDENTIALS environment variable

Open calbasi opened this issue 3 years ago • 2 comments

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

calbasi avatar Sep 17 '22 09:09 calbasi

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

nijel avatar Sep 19 '22 07:09 nijel

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.

github-actions[bot] avatar Sep 19 '22 07:09 github-actions[bot]

I would like to work on this. Can you please assign this to me?

jatinmark avatar Oct 02 '22 15:10 jatinmark

@jatinmark Yes, you're welcome.

nijel avatar Oct 25 '22 09:10 nijel

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.

nijel avatar Nov 04 '22 14:11 nijel

Has Jatin closed this issue or Is it still open? I can work on this

Dbhardwaj99 avatar Dec 23 '22 16:12 Dbhardwaj99

Yes , you can work on this issue .

jatinmark avatar Dec 23 '22 17:12 jatinmark

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}'

Dbhardwaj99 avatar Dec 23 '22 18:12 Dbhardwaj99

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.

nijel avatar Jan 06 '23 14:01 nijel

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.

github-actions[bot] avatar Sep 21 '23 10:09 github-actions[bot]