go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.08k stars 5.41k forks source link

[Feature Request] Add creation OAuth APP from cli and with ENVIRONMENT VARS #8764

Open toni-moreno opened 4 years ago

toni-moreno commented 4 years ago

Description

We have to automate the Gitea + Drone Install , but , we can not automate the setup process because of gitea needs to setup OAuth APP from WebUI As described in (https://docs.drone.io/installation/providers/gitea/) )

On Docker environments the best way is with environment vars (not sure how to do it ) but really useful on this use case.

zeripath commented 4 years ago

Would my pr #7287 be sufficient for this?

techknowlogick commented 4 years ago

@zeripath I dont think so because that would just configure app.ini settings. This request is to setup an OAuth2 provider using env vars. I would prefer to add it via CLI, just like we did for other OAuth app/LDAP management.

lunny commented 4 years ago

OAuth2 Provider is enabled by default. I think he means create an OAuth2 application via commandline and return ClientID and ClientSecret with suitable console format.

lukasmrtvy commented 4 years ago

Not sure if API/CLI commands are enough in this case. ( Unattended install of gitea and drone - integrated ), but its definetly must have feature of course for future generic usage.

Something like GITEA_OAUTH2_PROVIDER_ID, GITEA_OAUTH2_PROVIDER_SECRET and GITEA_OAUTH2_PROVIDER_REPLYURL vars ( for precreating oauth application ) should be enough to deploy both applications at the same time ( integration at deploy time ). Of course GITEA_USERNAME and GITEA_PASSWORD vars would be also superb to implement.

Other options like docker exec -it gitea gitea admin oauth2 app create... or curl -X POST http://gitea/api/v1/user/application '{"id": ...}', that needs output parsing and use it as input for another container ( drone in this case ) are not best way how to do it.

lukasmrtvy commented 4 years ago

Proposal https://github.com/go-gitea/gitea/issues/9210

danielchg commented 4 years ago

is there any update on this issue?

everflux commented 2 years ago

Is this available through the CLI as well? (For unattended setup - it is important that the clientid/secret can be supplied/specified instead of randomly generated. )

gramakri commented 1 year ago

Per https://docs.gitea.io/en-us/command-line/#admin , gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE is an example

lunny commented 1 year ago

I think this has been resolved.

maxkratz commented 1 year ago

Per https://docs.gitea.io/en-us/command-line/#admin , gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE is an example

This command can be used to add a new authentication source, but OP wants to add an oauth2 application. Can this be done with the CLI?

lunny commented 1 year ago

Per https://docs.gitea.io/en-us/command-line/#admin , gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE is an example

This command can be used to add a new authentication source, but OP wants to add an oauth2 application. Can this be done with the CLI?

Not yet.

maxkratz commented 1 year ago

Not yet.

Thank you for your fast response. In this case, I suggest to re-open this issue.

everflux commented 6 months ago

It would be really great, if this could be addressed as manual setup takes a lot of time and is error prone when setting up multiple instances for trainings or demos. (So an ENV approach is preferred to CLI)