Skip to content
Snippets Groups Projects

Resolve "Credentials returned after registering an app are hard coded, which causes problems if RabbitMQ is not hosted on localhost"

Files
2
+ 6
1
@@ -4,6 +4,7 @@ import (
@@ -4,6 +4,7 @@ import (
"context"
"context"
"fmt"
"fmt"
 
"code.fbi.h-da.de/danet/gosdn/controller/config"
"code.fbi.h-da.de/danet/gosdn/controller/store"
"code.fbi.h-da.de/danet/gosdn/controller/store"
"github.com/google/uuid"
"github.com/google/uuid"
)
)
@@ -66,7 +67,7 @@ func (a *Service) createNewApp(appName string) (*App, error) {
@@ -66,7 +67,7 @@ func (a *Service) createNewApp(appName string) (*App, error) {
app := App{
app := App{
ID: uuid.New(),
ID: uuid.New(),
Name: appName,
Name: appName,
EventSystemCredentials: "amqp://guest:guest@127.0.0.1:5672",
EventSystemCredentials: buildQueueCredentials(),
}
}
// generate app credentials
// generate app credentials
@@ -77,3 +78,7 @@ func (a *Service) createNewApp(appName string) (*App, error) {
@@ -77,3 +78,7 @@ func (a *Service) createNewApp(appName string) (*App, error) {
return &app, nil
return &app, nil
}
}
 
 
func buildQueueCredentials() string {
 
return fmt.Sprintf("%s%s:%s@%s:%s/", config.AMQPPrefix, config.AMQPUser, config.AMQPPassword, config.AMQPHost, config.AMQPPort)
 
}
Loading