Skip to content

Commit

Permalink
ref: start application refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
thoas committed Feb 25, 2018
1 parent 62271a5 commit fad0620
Show file tree
Hide file tree
Showing 8 changed files with 541 additions and 444 deletions.
26 changes: 2 additions & 24 deletions application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,8 @@ import (
"github.com/thoas/picfit/storage"
)

// LoadFromConfigContent returns a net/context from content
func LoadFromConfigContent(content string) (context.Context, error) {
cfg, err := config.LoadFromContent(content)

if err != nil {
return nil, err
}

return LoadFromConfig(cfg)
}

// LoadFromConfig returns a net/context from a config.Config instance
func LoadFromConfig(cfg *config.Config) (context.Context, error) {
// Load returns a net/context from a config.Config instance
func Load(cfg *config.Config) (context.Context, error) {
ctx := config.NewContext(context.Background(), *cfg)

sourceStorage, destinationStorage, err := storage.New(cfg.Storage)
Expand Down Expand Up @@ -63,17 +52,6 @@ func LoadFromConfig(cfg *config.Config) (context.Context, error) {
return ctx, nil
}

// Load creates a net/context from a file config path
func Load(path string) (context.Context, error) {
cfg, err := config.Load(path)

if err != nil {
return nil, err
}

return LoadFromConfig(cfg)
}

// Store stores an image file with the defined filepath
func Store(ctx context.Context, filepath string, i *image.ImageFile) error {
l := logger.FromContext(ctx)
Expand Down
Loading

0 comments on commit fad0620

Please sign in to comment.