Skip to content

Commit

Permalink
Clean code.
Browse files Browse the repository at this point in the history
  • Loading branch information
artjoma committed Nov 21, 2023
1 parent 72abf53 commit 665b467
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Engine struct {
}

func NewEngine(tempFolder string, db *mosaicdb.Database, dataStorage *storage.Storage,
uploadWorkersCount int, downloadWorkersCount int) (*Engine, error) {
uploadWorkersCount int) (*Engine, error) {
// create folder if not exists
err := os.MkdirAll(tempFolder, 0774)
slog.Info("Create dir", "path", tempFolder, "err", err)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func main() {
func setup(appCfg *types.AppConfig) {
database := mosaicdb.NewDatabase(appCfg.DbPath)
storage := storage.NewStorage()
engine, err := engine.NewEngine(appCfg.FilesTempFolder, database, storage, int(appCfg.FileUploadWorkersCount), int(appCfg.FileDownloadWorkersCount))
engine, err := engine.NewEngine(appCfg.FilesTempFolder, database, storage, int(appCfg.FileUploadWorkersCount))
if err != nil {
panic(err)
}
Expand Down
11 changes: 5 additions & 6 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import (
*/

type AppConfig struct {
ApiHttpPort uint16 `env:"API_HTTP_PORT" envDefault:"25010"`
ApiHttpAddress string `env:"API_HTTP_ADDRESS" envDefault:"0.0.0.0"`
FilesTempFolder string `env:"FILES_TEMP_FOLDER" envDefault:"/tmp/masaic/temp"` // http file upload folder
DbPath string `env:"API_DB_PATH" envDefault:""`
FileUploadWorkersCount uint8 `env:"FILE_UPLOAD_WORKERS_COUNT" envDefault:"10"`
FileDownloadWorkersCount uint8 `env:"FILE_DOWNLOAD_WORKERS_COUNT" envDefault:"10"`
ApiHttpPort uint16 `env:"API_HTTP_PORT" envDefault:"25010"`
ApiHttpAddress string `env:"API_HTTP_ADDRESS" envDefault:"0.0.0.0"`
FilesTempFolder string `env:"FILES_TEMP_FOLDER" envDefault:"/tmp/masaic/temp"` // http file upload folder
DbPath string `env:"API_DB_PATH" envDefault:""`
FileUploadWorkersCount uint8 `env:"FILE_UPLOAD_WORKERS_COUNT" envDefault:"10"`
}

// H256 hash 256 bit length
Expand Down

0 comments on commit 665b467

Please sign in to comment.