@@ -10,6 +10,8 @@ import (
1010 "github.com/deis/workflow/client/controller/client"
1111)
1212
13+ const workflowURLPrefix = "deis."
14+
1315// List lists apps on a Deis controller.
1416func List (c * client.Client , results int ) ([]api.App , int , error ) {
1517 body , count , err := c .LimitedRequest ("/v2/apps/" , results )
@@ -25,7 +27,7 @@ func List(c *client.Client, results int) ([]api.App, int, error) {
2527
2628 for name , app := range apps {
2729 // Add in app URL based on controller hostname, port included
28- app .URL = fmt .Sprintf ("%s.%s" , app .ID , c .ControllerURL .Host )
30+ app .URL = fmt .Sprintf ("%s.%s" , app .ID , strings . TrimPrefix ( c .ControllerURL .Host , workflowURLPrefix ) )
2931 apps [name ] = app
3032 }
3133
@@ -58,7 +60,7 @@ func New(c *client.Client, id string) (api.App, error) {
5860 }
5961
6062 // Add in app URL based on controller hostname, port included
61- app .URL = fmt .Sprintf ("%s.%s" , app .ID , c .ControllerURL .Host )
63+ app .URL = fmt .Sprintf ("%s.%s" , app .ID , strings . TrimPrefix ( c .ControllerURL .Host , workflowURLPrefix ) )
6264
6365 return app , nil
6466}
@@ -80,7 +82,7 @@ func Get(c *client.Client, appID string) (api.App, error) {
8082 }
8183
8284 // Add in app URL based on controller hostname, port included
83- app .URL = fmt .Sprintf ("%s.%s" , app .ID , c .ControllerURL .Host )
85+ app .URL = fmt .Sprintf ("%s.%s" , app .ID , strings . TrimPrefix ( c .ControllerURL .Host , workflowURLPrefix ) )
8486
8587 return app , nil
8688}
0 commit comments