Add/edit the mailer through the web interface after setup #705

Open
opened 2025-11-02 03:33:43 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @gayprogrammer on GitHub (May 12, 2017).

  • Gitea version (or commit ref): 9a0b0da
  • Git version: 2.12.2
  • Operating system: Windows Server 2012
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant (I am not administrator on try.gitea.io)
  • Log gist: NA

Description

I would like to ask for the ability to add the mailer through the web interface after setup. Also I think it is common sense to be able to edit the mailer configuration through the web interface. I did not initially set one up, so my custom app.ini config only contained:
[mailer]
ENABLED = false
When I changed this to true, Gitea failed to start. I found in the log:
2017/05/12 10:37:51 [...s/setting/setting.go:1274 newMailService()] [E] Invalid mailer.FROM (): mail: no address
This field was not in my config, so I had to copy it from source and complete the configuration before I could get Gitea to start.

Originally created by @gayprogrammer on GitHub (May 12, 2017). - Gitea version (or commit ref): 9a0b0da - Git version: 2.12.2 - Operating system: Windows Server 2012 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [x] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant (I am not administrator on try.gitea.io) - Log gist: NA ## Description I would like to ask for the ability to add the mailer through the web interface after setup. Also I think it is common sense to be able to edit the mailer configuration through the web interface. I did not initially set one up, so my custom app.ini config only contained: `[mailer]` `ENABLED = false` When I changed this to `true`, Gitea failed to start. I found in the log: `2017/05/12 10:37:51 [...s/setting/setting.go:1274 newMailService()] [E] Invalid mailer.FROM (): mail: no address` This field was not in my config, so I had to copy it from source and complete the configuration before I could get Gitea to start.
GiteaMirror added the type/proposal label 2025-11-02 03:33:43 -06:00
Author
Owner

@kolaente commented on GitHub (May 13, 2017):

I think we should enable overall configuration through the webinterface after installing, not only for mail settings

@kolaente commented on GitHub (May 13, 2017): I think we should enable overall configuration through the webinterface after installing, not only for mail settings
Author
Owner

@bkcsoft commented on GitHub (May 14, 2017):

enable overall configuration through the webinterface

There's a lot of values that can not be changed during runtime, which is why Gitea doesn't allow for them to be changed in the WebUI.
A few of them listed here:

  • RUN_USER would require a complete restart of the service. And can not be done by Gitea itself.
  • server.HTTP_PORT | HTTP_ADDR | PROTOCOL would require a restart of the http-server. Could be done by Gitea, but would kill any current connections (unless gracefully)
  • server.SSH_PORT would require a restart of the ssh-server. Same as above ☝️
  • database.* would require a complete restart of Gitea. Could be done inside Gitea itself, but I don't see the point in this really.

But the biggest problem is that we don't load partial configs. So Gitea wouldn't know what has been changed, and would therefore require a complete restart done by an outsider (see RUN_USER)

@bkcsoft commented on GitHub (May 14, 2017): > enable overall configuration through the webinterface There's a lot of values that _can not_ be changed during runtime, which is why Gitea doesn't allow for them to be changed in the WebUI. A few of them listed here: - `RUN_USER` would require a complete restart of the service. And can not be done by Gitea itself. - `server.HTTP_PORT | HTTP_ADDR | PROTOCOL` would require a restart of the http-server. Could be done by Gitea, but would kill any current connections (unless gracefully) - `server.SSH_PORT` would require a restart of the ssh-server. Same as above ☝️ - `database.*` would require a complete restart of Gitea. Could be done inside Gitea itself, but I don't see the point in this really. But the _biggest_ problem is that we don't load partial configs. So Gitea wouldn't know what has been changed, and would therefore require a _complete_ restart done by an outsider (see `RUN_USER`)
Author
Owner

@gayprogrammer commented on GitHub (May 17, 2017):

So currently Gitea can not reinitialize itself? Most software accepts this limitation by including a warning like: "A restart is needed before changes will take effect". Would this be an okay compromise?

There are still good reasons to allow editing in the web interface. For example, settings will be validated before they are written, and settings that depend on other settings can be marked as required.

The core problem of this issue is that the settings I needed did not exist in my config file, nor on the web config page. I needed to piece them together through trial and error until I had a valid config again.

@gayprogrammer commented on GitHub (May 17, 2017): So currently Gitea can not reinitialize itself? Most software accepts this limitation by including a warning like: "A restart is needed before changes will take effect". Would this be an okay compromise? There are still good reasons to allow editing in the web interface. For example, settings will be validated before they are written, and settings that depend on other settings can be marked as required. The core problem of this issue is that the settings I needed did not exist in my config file, nor on the web config page. I needed to piece them together through trial and error until I had a valid config again.
Author
Owner

@bkcsoft commented on GitHub (May 19, 2017):

did not exist in my config file, [...]. I needed to add them through trial and error until I had a valid config again.

https://github.com/go-gitea/gitea/blob/master/conf/app.ini#L263-L294

With that said, our documentation definitively needs improvement 😂

@bkcsoft commented on GitHub (May 19, 2017): > did not exist in my config file, [...]. I needed to add them through trial and error until I had a valid config again. https://github.com/go-gitea/gitea/blob/master/conf/app.ini#L263-L294 With that said, our documentation definitively needs improvement 😂
Author
Owner

@A9G-Data-Droid commented on GitHub (May 7, 2021):

@bkcsoft Your link is now 404. I am a new user who was shocked to find I had to SSH in and modify a text file every time I need to change a setting. I would think that at a minimum there could be a list of simple configs that could be changed without a full restart. For example, I want to change the items in the "Service Configuration" section of the config page. There was no edit button. You already have the settings broken in to sections in the UI. Each of those could have an edit button. This would allow you to add the ability to edit, one section at a time, starting with sections that are easy to implement with no restart required.

@A9G-Data-Droid commented on GitHub (May 7, 2021): @bkcsoft Your link is now 404. I am a new user who was shocked to find I had to SSH in and modify a text file every time I need to change a setting. I would think that at a minimum there could be a list of simple configs that could be changed without a full restart. For example, I want to change the items in the "Service Configuration" section of the config page. There was no edit button. You already have the settings broken in to sections in the UI. Each of those could have an edit button. This would allow you to add the ability to edit, one section at a time, starting with sections that are easy to implement with no restart required.
Author
Owner

@xgdgsc commented on GitHub (Apr 18, 2023):

I would like to use https://github.com/fsnotify/fsnotify to implement the config reloading. Is there a list of configs that can be changed without restart?

@xgdgsc commented on GitHub (Apr 18, 2023): I would like to use https://github.com/fsnotify/fsnotify to implement the config reloading. Is there a list of configs that can be changed without restart?
Author
Owner

@yardenshoham commented on GitHub (Apr 18, 2023):

Could we use https://github.com/go-gitea/gitea/pull/18058 for this?
cc @lunny

@yardenshoham commented on GitHub (Apr 18, 2023): Could we use https://github.com/go-gitea/gitea/pull/18058 for this? cc @lunny
Author
Owner

@lunny commented on GitHub (Apr 18, 2023):

Could we use https://github.com/go-gitea/gitea/pull/18058 for this?

cc @lunny

I think yes. We need a PR and migration. But some systemadmin and ansible authors may against it. Maybe we need a Gitea init command to accept an initial configuration file to resolve their problem.

@lunny commented on GitHub (Apr 18, 2023): > Could we use https://github.com/go-gitea/gitea/pull/18058 for this? > > cc @lunny I think yes. We need a PR and migration. But some systemadmin and ansible authors may against it. Maybe we need a Gitea init command to accept an initial configuration file to resolve their problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#705