Skip to content

Commit

Permalink
reduce worspace interface
Browse files Browse the repository at this point in the history
Make few things not used outside of pacakge private.
  • Loading branch information
ianic committed Oct 15, 2021
1 parent 06dd93d commit a49d0b6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
10 changes: 0 additions & 10 deletions workspace/mantil.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@ package workspace

import (
"fmt"

"github.com/mantil-io/mantil/aws"
)

func Bucket(aws *aws.AWS, resourceSuffix string) string {
return bucket(aws.Region(), resourceSuffix)
}

func bucket(awsRegion, resourceSuffix string) string {
return fmt.Sprintf("mantil-%s-%s", awsRegion, resourceSuffix)
}

func RuntimeResource(v ...string) string {
r := "mantil"
for _, n := range v {
Expand Down
11 changes: 0 additions & 11 deletions workspace/public.go

This file was deleted.

10 changes: 10 additions & 0 deletions workspace/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ type Stage struct {
Public *Public `yaml:"public,omitempty"`
}

type Public struct {
Bucket string `yaml:"bucket"`
Sites []*PublicSite `yaml:"sites"`
}

type PublicSite struct {
Name string `yaml:"name"`
Hash string `yaml:"hash"`
}

func (s *Stage) ResourceTags() map[string]string {
return map[string]string{
TagStageName: s.Name,
Expand Down
3 changes: 2 additions & 1 deletion workspace/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ func (w *Workspace) NewAccount(name, awsAccountID, awsRegion, functionsBucket, f
if err != nil {
return nil, log.Wrap(err, "could not create public/private key pair")
}
bucket := fmt.Sprintf("mantil-%s-%s", awsRegion, w.ResourceSuffix())
a := &Account{
Name: name,
ID: awsAccountID,
Region: awsRegion,
Bucket: bucket(awsRegion, w.ResourceSuffix()),
Bucket: bucket,
Keys: AccountKeys{
Public: publicKey,
Private: privateKey,
Expand Down

0 comments on commit a49d0b6

Please sign in to comment.