@@ -132,33 +132,39 @@ private List<EffectiveBinding> ComputeBindings(Service service, string defaultHo
132
132
{
133
133
var bindings = new List < EffectiveBinding > ( ) ;
134
134
135
+ var isDockerRunInfo = service . Description . RunInfo is DockerRunInfo ;
136
+ GetEffectiveBindings ( isDockerRunInfo , defaultHost , bindings , service ) ;
137
+
135
138
foreach ( var serv in service . Description . Dependencies )
136
139
{
137
- var s = Services [ serv ] ;
140
+ GetEffectiveBindings ( isDockerRunInfo , defaultHost , bindings , Services [ serv ] ) ;
141
+ }
138
142
139
- foreach ( var b in s . Description . Bindings )
140
- {
141
- var protocol = b . Protocol ;
142
- var host = b . Host ?? ( service . Description . RunInfo is DockerRunInfo ? s . Description . Name : defaultHost ) ;
143
+ return bindings ;
144
+ }
143
145
144
- var port = b . Port ;
145
- if ( b . Port is object && service . Description . RunInfo is DockerRunInfo )
146
- {
147
- port = b . ContainerPort ?? b . Port . Value ;
148
- }
146
+ private static void GetEffectiveBindings ( bool isDockerRunInfo , string defaultHost , List < EffectiveBinding > bindings , Service service )
147
+ {
148
+ foreach ( var b in service . Description . Bindings )
149
+ {
150
+ var protocol = b . Protocol ;
151
+ var host = b . Host ?? ( isDockerRunInfo ? service . Description . Name : defaultHost ) ;
149
152
150
- bindings . Add ( new EffectiveBinding (
151
- s . Description . Name ,
152
- b . Name ,
153
- protocol ,
154
- host ,
155
- port ,
156
- b . ConnectionString ,
157
- s . Description . Configuration ) ) ;
153
+ var port = b . Port ;
154
+ if ( b . Port is object && isDockerRunInfo )
155
+ {
156
+ port = b . ContainerPort ?? b . Port . Value ;
158
157
}
159
- }
160
158
161
- return bindings ;
159
+ bindings . Add ( new EffectiveBinding (
160
+ service . Description . Name ,
161
+ b . Name ,
162
+ protocol ,
163
+ host ,
164
+ port ,
165
+ b . ConnectionString ,
166
+ service . Description . Configuration ) ) ;
167
+ }
162
168
}
163
169
}
164
170
}
0 commit comments