diff --git a/controller/app/Service.go b/controller/app/Service.go index 2f02f7743a8a8da29ac8092dd33b5e1138165660..5a8c62176f494725d44e312a8eaa57a979572404 100644 --- a/controller/app/Service.go +++ b/controller/app/Service.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "code.fbi.h-da.de/danet/gosdn/controller/config" "code.fbi.h-da.de/danet/gosdn/controller/store" "github.com/google/uuid" ) @@ -66,7 +67,7 @@ func (a *Service) createNewApp(appName string) (*App, error) { app := App{ ID: uuid.New(), Name: appName, - EventSystemCredentials: "amqp://guest:guest@127.0.0.1:5672", + EventSystemCredentials: buildQueueCredentials(), } // generate app credentials @@ -77,3 +78,7 @@ func (a *Service) createNewApp(appName string) (*App, error) { return &app, nil } + +func buildQueueCredentials() string { + return fmt.Sprintf("%s%s:%s@%s:%s/", config.AMQPPrefix, config.AMQPUser, config.AMQPPassword, config.AMQPHost, config.AMQPPort) +} diff --git a/integration-tests/application_tests/appUtility_test.go b/integration-tests/application_tests/appUtility_test.go index 4539072576150b1742635ed42307cfa17cfa0da2..cf25f6c66fdf58dad6fc0293f0449b365c100941 100644 --- a/integration-tests/application_tests/appUtility_test.go +++ b/integration-tests/application_tests/appUtility_test.go @@ -14,6 +14,7 @@ import ( ) const localhost = "127.0.0.1" +const rabbitmq = "rabbitmq" // Application is an example for a sdn application. type Application struct { @@ -33,8 +34,8 @@ func NewApplication(ctx context.Context, grpcClientConn *grpc.ClientConn, contro os.Exit(1) } - if rabbitMQAddress != "" { - queueCredentials = strings.ReplaceAll(queueCredentials, localhost, rabbitMQAddress) + if rabbitMQAddress == "" { + queueCredentials = strings.ReplaceAll(queueCredentials, rabbitmq, localhost) } eventService, err := event.NewEventService(