From b4849ccab46cf3f55f109436153e45a175888792 Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 14 Apr 2020 11:07:07 +0100 Subject: Remove unused PreprocPattern, allow sensible defaults with aws setup, and add a little more documentation --- aws.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'aws.go') diff --git a/aws.go b/aws.go index 70189ea..59f1a7e 100644 --- a/aws.go +++ b/aws.go @@ -20,7 +20,7 @@ import ( "github.com/aws/aws-sdk-go/service/sqs" ) -const PreprocPattern = `_bin[0-9].[0-9].png` +const defaultAwsRegion = `eu-west-2` type Qmsg struct { Id, Handle, Body string @@ -35,8 +35,11 @@ type ObjMeta struct { Date time.Time } +// AwsConn contains the necessary things to interact with various AWS +// services in ways useful for the bookpipeline package. It is +// designed to be generic enough to swap in other backends easily. type AwsConn struct { - // these need to be set before running Init() + // these should be set before running Init(), or left to defaults Region string Logger *log.Logger @@ -53,10 +56,10 @@ type AwsConn struct { // MinimalInit does the bare minimum to initialise aws services func (a *AwsConn) MinimalInit() error { if a.Region == "" { - return errors.New("No Region set") + a.Region = defaultAwsRegion } if a.Logger == nil { - return errors.New("No logger set") + a.Logger = log.New(os.Stdout, "", 0) } var err error -- cgit v1.2.1-24-ge1ad