-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(appstore): Handle Website Directory During Second Installation o… #7649
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,19 +31,6 @@ func (i *AppInstall) GetPath() string { | |
| return path.Join(i.GetAppPath(), i.Name) | ||
| } | ||
|
|
||
| //func (i *AppInstall) GetSiteDir() string { | ||
| // var data map[string]interface{} | ||
| // err := json.Unmarshal([]byte(i.Env), &data) | ||
| // if err != nil { | ||
| // return path.Join(i.GetAppPath(), i.Name, "www") | ||
| // } | ||
| // websiteDir, ok := data["WEBSITE_DIR"].(string) | ||
| // if !ok || websiteDir == "" { | ||
| // return path.Join(i.GetAppPath(), i.Name, "www") | ||
| // } | ||
| // return websiteDir | ||
| //} | ||
|
|
||
| func (i *AppInstall) GetComposePath() string { | ||
| return path.Join(i.GetAppPath(), i.Name, "docker-compose.yml") | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes made between the original code and mine are: Original function to get the site directory is missing. My suggestion is: Create function var data map[string]interface{}
if err := json.Unmarshal([]byte(i.Env), &data); err != nil {
return path.Join(i.GetAppPath(), i Name, "www")
}
websiteDir, ok := data["WEBSITEDIOR"].(string)
If not OK or websitedir exists then use 'path.Join' and 'i.GetName()' instead of direct valueFor optimization you can add docstrings at top and bottom of file if they're not present else remove unnecessary space in Go comments as it looks better. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,8 @@ type IFileService interface { | |
| ChangeMode(op request.FileCreate) error | ||
| BatchChangeModeAndOwner(op request.FileRoleReq) error | ||
| ReadLogByLine(req request.FileReadByLineReq) (*response.FileLineContent, error) | ||
|
|
||
| GetPathByType(pathType string) string | ||
| } | ||
|
|
||
| var filteredPaths = []string{ | ||
|
|
@@ -483,3 +485,14 @@ func (f *FileService) ReadLogByLine(req request.FileReadByLineReq) (*response.Fi | |
| } | ||
| return res, nil | ||
| } | ||
|
|
||
| func (f *FileService) GetPathByType(pathType string) string { | ||
| if pathType == "websiteDir" { | ||
| value, _ := settingRepo.GetValueByKey("WEBSITE_DIR") | ||
| if value == "" { | ||
| return path.Join(global.CONF.System.BaseDir, "www") | ||
| } | ||
| return value | ||
| } | ||
| return "" | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code snippet is not formatted properly so it's difficult to review and determine if there are any irregularities, potential issues, or optimization suggestions. Please ensure that all lines in every file have been properly indented before reviewing them. For instance: type IFileService interface {
// methods
}
// Implementation of the FileInterface
...Then run this through |
||
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.
There are no major code changes between the two provided versions. The only significant difference is the addition of error handling to both functions. If anything else needs an investigation, please let me know; I'm here to help.