-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Set session and indexers' data files rel to AppDataPath #2192
Conversation
Also fixes #1378 |
modules/setting/setting.go
Outdated
@@ -1243,7 +1243,7 @@ func newCacheService() { | |||
func newSessionService() { | |||
SessionConfig.Provider = Cfg.Section("session").Key("PROVIDER").In("memory", | |||
[]string{"memory", "file", "redis", "mysql"}) | |||
SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ") | |||
SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").MustString(path.Join(AppDataPath, "data/sessions")), "\" ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
models/models.go
Outdated
@@ -147,7 +147,7 @@ func LoadConfigs() { | |||
DbCfg.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500) | |||
|
|||
sec = setting.Cfg.Section("indexer") | |||
setting.Indexer.IssuePath = sec.Key("ISSUE_INDEXER_PATH").MustString("indexers/issues.bleve") | |||
setting.Indexer.IssuePath = sec.Key("ISSUE_INDEXER_PATH").MustString(path.Join(setting.AppDataPath, "indexers/issues.bleve")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be checked if path is absolute (see https://github.com/go-gitea/gitea/blob/master/modules/setting/setting.go#L842)
9b9890a
to
ca3ff45
Compare
I am not used to the pull request process. I amended my current commit to include the feedback. Is this the correct method? I added a new setting variable containing the working directory named |
Now it is called differently in multiple places so either dir or path but do not mix (i would vote for path). You can add commits to your branch and they will show up here |
Ok I changed to workPath the fn & vars that were named workDir. Anything else? |
I just added a minor change to the path ProviderConfig. I forgot to remove the "data" in "data/sessions" when joining with AppDataPath. By the way, I noticed we use |
21714a3
to
5c0f65f
Compare
@dubeg Please fix formatting issues (see drone build that is failing). |
@dubeg need rebase |
@@ -1188,7 +1187,7 @@ func NewXORMLogService(disableConsole bool) { | |||
if err = os.MkdirAll(path.Dir(logPath), os.ModePerm); err != nil { | |||
panic(err.Error()) | |||
} | |||
logPath = filepath.Join(filepath.Dir(logPath), "xorm.log") | |||
logPath = path.Join(filepath.Dir(logPath), "xorm.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change filepath
to path
?
need rebase. |
Sorry I've been terribly busy and also lazy since August. I'll try to fix the PR this week. As for filepath to path, I didn't know the purpose of each of them until Lafriks commented on them. I'll review what I did on that matter. |
@dubeg Or could you give the permission to let maintainers to help you to push to this PR. |
@lunny How can I do that? |
@dubeg yes |
@lunny Well it's been checked for a while. If you want to finish to modify the PR, go ahead. Otherwise I'll work on it this weekend. |
The setting AppDataPath is now relative to the working directory. The session svc's PROVIDER_CONFIG now defaults to AppDataPath/data/sessions. The issue indexer's IssuePath now defaults to AppDataPath/indexers/issues.bleves.
Codecov Report
@@ Coverage Diff @@
## master #2192 +/- ##
==========================================
+ Coverage 26.84% 26.85% +<.01%
==========================================
Files 89 89
Lines 17609 17607 -2
==========================================
Hits 4728 4728
+ Misses 12195 12193 -2
Partials 686 686
Continue to review full report at Codecov.
|
@dubeg rebased and LGTM |
LGTM |
The setting AppDataPath now defaults to being relative to the working directory.
The session svc's PROVIDER_CONFIG now defaults to AppDataPath/data/sessions.
The issue indexer's IssuePath now defaults to AppDataPath/indexers/issues.bleves.
This change targets #2159.