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

Do not overwrite the log mode when installing (#25203) #25209

Merged
merged 2 commits into from
Jun 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions routers/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,9 @@ func SubmitInstall(ctx *context.Context) {

cfg.Section("session").Key("PROVIDER").SetValue("file")

cfg.Section("log").Key("MODE").SetValue("console")
cfg.Section("log").Key("MODE").MustString("console")
cfg.Section("log").Key("LEVEL").SetValue(setting.Log.Level.String())
cfg.Section("log").Key("ROOT_PATH").SetValue(form.LogRootPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, shouldn't all these other keys be MustString either?
It seems a bit strange that only the log isn't overwritten?`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope.

setting.Log.Level is from the config, so no overwritten

form.LogRootPath is from user input (by default is also from the config)

  • if user ever changed it, then it must overwrite
  • if user didn't change it, still no overwritten

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if we simply go by values that are explicitly set here, those are still [session].PROVIDER, [repository.pull-request].DEFAULT_MERGE_STYLE, and [repository.signing].DEFAULT_TRUST_MODEL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are still many legacy problems. I have searched these "SetValue" while I think we do not need to change too much at the moment.

Leave the problem to after the INI package refactoring.

And, end users could always prepare a full app.ini with "INSTALL_LOCK=true", then no overwriting problem anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about to prevent user installing again from UI?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I have done so
  2. Some users are doing fresh installation, the "app.ini" comes from docker environment variables, they do not "install again".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess a backport is not the right place to discuss 😆

cfg.Section("log").Key("ROUTER").SetValue("console")

cfg.Section("repository.pull-request").Key("DEFAULT_MERGE_STYLE").SetValue("merge")

Expand Down