INFRA-558 | Deepak Jain| adding workspace

This commit is contained in:
Deepak Jain
2020-10-12 19:05:56 +05:30
parent ceb330a821
commit d9052be2cf
2 changed files with 9 additions and 6 deletions

11
main.go
View File

@@ -2,13 +2,14 @@ package main
import ( import (
"encoding/json" "encoding/json"
"io/ioutil"
"log"
"os"
"github.com/a8m/envsubst" "github.com/a8m/envsubst"
"github.com/asaskevich/govalidator" "github.com/asaskevich/govalidator"
"github.com/caarlos0/env/v6" "github.com/caarlos0/env/v6"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"io/ioutil"
"log"
"os"
) )
func init() { func init() {
@@ -51,8 +52,10 @@ func parseManifest(manifestPath string) (*Manifest, error) {
if manifest.ExtraResources.Environment == "" { if manifest.ExtraResources.Environment == "" {
manifest.ExtraResources.Environment = manifest.Environment manifest.ExtraResources.Environment = manifest.Environment
} }
if manifest.ExtraResources.Workspace == "" {
manifest.ExtraResources.Workspace = workspaceMap[manifest.ExtraResources.Environment] manifest.ExtraResources.Workspace = workspaceMap[manifest.ExtraResources.Environment]
}
if manifest.Deployment == nil { if manifest.Deployment == nil {
manifest.Deployment = &Deployment{} manifest.Deployment = &Deployment{}
} }

View File

@@ -18,7 +18,7 @@ type Manifest struct {
type ExtraResources struct { type ExtraResources struct {
//TODO: Remove environment from ExtraResources once all apps have migrated to new schema //TODO: Remove environment from ExtraResources once all apps have migrated to new schema
Environment string `json:"environment"` Environment string `json:"environment"`
Workspace string Workspace string `json:"workspace"`
Database *Database `json:"database"` Database *Database `json:"database"`
ServiceRole *ServiceRole `json:"aws_access"` ServiceRole *ServiceRole `json:"aws_access"`
S3Buckets []S3Bucket `json:"s3_buckets"` S3Buckets []S3Bucket `json:"s3_buckets"`