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

expose SOCIAL_AUTH_GITEA config options for docker deployment #8205

Closed
Bubu opened this issue Oct 11, 2022 · 14 comments
Closed

expose SOCIAL_AUTH_GITEA config options for docker deployment #8205

Bubu opened this issue Oct 11, 2022 · 14 comments
Assignees
Labels
enhancement Adding or requesting a new feature. good first issue Opportunity for newcoming contributors. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed.
Milestone

Comments

@Bubu
Copy link
Contributor

Bubu commented Oct 11, 2022

Describe the problem

We'd like to configure gitea oauth for a docker deployment. This currently requires using settings-override.py, it would be nice if it instead can be exposed like all the other oauth settings via WEBLATE_* env vars.

Describe the solution you'd like

see above

Describe alternatives you've considered

No response

Screenshots

No response

Additional context

No response

@nijel nijel added enhancement Adding or requesting a new feature. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed. good first issue Opportunity for newcoming contributors. labels Oct 12, 2022
@github-actions
Copy link

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.

@Revortni
Copy link
Contributor

@nijel hey I'd like to give this a try

@nijel
Copy link
Member

nijel commented Oct 17, 2022

@Revortni you're welcome!

@Revortni
Copy link
Contributor

@nijel The issue mentions a settings-override.py file but i couldn't find it in the code, nor could i find SOCIAL_AUTH_GITEA used anywhere. Am i missing something here?

@nijel
Copy link
Member

nijel commented Oct 17, 2022

The override settings is needed right now when the environment configuration is not supported. You should add something like what is used for other services:

if "WEBLATE_SOCIAL_AUTH_BITBUCKET_KEY" in os.environ:
AUTHENTICATION_BACKENDS += ("social_core.backends.bitbucket.BitbucketOAuth",)
SOCIAL_AUTH_BITBUCKET_KEY = os.environ.get("WEBLATE_SOCIAL_AUTH_BITBUCKET_KEY", "")
SOCIAL_AUTH_BITBUCKET_SECRET = os.environ.get(
"WEBLATE_SOCIAL_AUTH_BITBUCKET_SECRET", ""
)

@Revortni
Copy link
Contributor

Revortni commented Oct 17, 2022

ok so i looked into the social core documentation for gitea and it seems only the below code would suffice.
SOCIAL_AUTH_GITEA_KEY = os.environ.get("WEBLATE_SOCIAL_AUTH_GITEA_KEY", "")
SOCIAL_AUTH_GITEA_SECRET = os.environ.get( "WEBLATE_SOCIAL_AUTH_GITEA_SECRET", "" )

Uncertain if the api url will be needed

@Revortni
Copy link
Contributor

@nijel hey there. any comments on this?

@nijel
Copy link
Member

nijel commented Oct 19, 2022

You also need to add the backend to AUTHENTICATION_BACKENDS (see the above example).

@nijel
Copy link
Member

nijel commented Oct 19, 2022

The URL is most likely needed as well to specify the gitea server URL.

@Revortni
Copy link
Contributor

Revortni commented Oct 19, 2022

You also need to add the backend to AUTHENTICATION_BACKENDS (see the above example).

As you can see below the documentation does not specify any authentication backend for Gitea.

image
@nijel

@Revortni
Copy link
Contributor

The URL is most likely needed as well to specify the gitea server URL.

Ok will add a config for this too

@Revortni
Copy link
Contributor

@nijel I've mentioned my findings about the authentication backend above

@nijel
Copy link
Member

nijel commented Oct 25, 2022

It's generic way of enabling backends. Just look at the BitBucket example I've posted in #8205 (comment). Also, it would be great if you could actually test that the integration works...

@nijel nijel added this to the 4.15 milestone Dec 6, 2022
@nijel nijel closed this as completed in f371f1f Dec 6, 2022
@github-actions
Copy link

github-actions bot commented Dec 6, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature. good first issue Opportunity for newcoming contributors. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed.
Projects
None yet
Development

No branches or pull requests

3 participants