-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - Terrafrom Service RabbitMQ integration
- Loading branch information
1 parent
74d2dfa
commit f810f65
Showing
6 changed files
with
78 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 13 additions & 13 deletions
26
infrastructure/infrastructure.go → ...tructure/infrastructure/infrastrucutre.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
package infrastructure | ||
package infrastrucuture | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/leapfrogtechnology/shift/infrastructure/templates/providers/aws/frontend-architecture" | ||
"github.com/leapfrogtechnology/shift/infrastructure/utils" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
func InitializeFrontend() { | ||
credentialsJsonFile, err := os.Open("config.json") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer credentialsJsonFile.Close() | ||
byteValue, _ := ioutil.ReadAll(credentialsJsonFile) | ||
func InitializeFrontend(infrastructureArgs string) error{ | ||
|
||
var frontendArgs utils.FrontendInfrastructureVariables | ||
err = json.Unmarshal(byteValue, &frontendArgs) | ||
err := json.Unmarshal([]byte(infrastructureArgs), &frontendArgs) | ||
if err != nil { | ||
panic(err) | ||
utils.LogError(err, "Error Parsing Body") | ||
return err | ||
} | ||
workspaceDir := filepath.Join("/tmp", frontendArgs.CLIENT_NAME) | ||
utils.GenerateFrontendTemplateFile(frontend_architecture.InfrastructureTemplate, frontendArgs, workspaceDir) | ||
|
||
err = utils.GenerateFrontendTemplateFile(frontend_architecture.InfrastructureTemplate, frontendArgs, workspaceDir) | ||
if err != nil { | ||
utils.LogError(err, "Cannot Generate Template") | ||
return err | ||
} | ||
utils.RunInfrastructureChanges(workspaceDir) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "github.com/leapfrogtechnology/shift/infrastructure/infrastructure" | ||
|
||
func main() { | ||
infrastrucuture.InitializeFrontend() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package utils | ||
|
||
import "log" | ||
|
||
func FailOnError(err error, msg string) { | ||
if err != nil { | ||
log.Fatalf("%s: %s", msg, err) | ||
} | ||
} | ||
|
||
func LogError(err error, msg string) { | ||
log.Printf("%s: %s", msg, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters