本文整理汇总了Golang中github.com/convox/rack/manifest.Service类的典型用法代码示例。如果您正苦于以下问题:Golang Service类的具体用法?Golang Service怎么用?Golang Service使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Service类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestDefaultNetworkName
func TestDefaultNetworkName(t *testing.T) {
networks := manifest.Networks{}
s := manifest.Service{
Networks: networks,
}
assert.Equal(t, s.NetworkName(), "")
}
开发者ID:convox,项目名称:rack,代码行数:9,代码来源:service_test.go
示例2: generateManifest
func generateManifest(dir string, def string) error {
if exists("Procfile") {
pf, err := readProcfile("Procfile")
if err != nil {
return err
}
m := manifest.Manifest{
Services: make(map[string]manifest.Service),
}
for _, e := range pf {
me := manifest.Service{
Build: manifest.Build{
Context: ".",
},
Command: manifest.Command{
String: e.Command,
},
Labels: make(manifest.Labels),
Ports: make(manifest.Ports, 0),
}
switch e.Name {
case "web":
me.Labels["convox.port.443.protocol"] = "tls"
me.Labels["convox.port.443.proxy"] = "true"
me.Ports = append(me.Ports, manifest.Port{
Balancer: 80,
Container: 4000,
Public: true,
})
me.Ports = append(me.Ports, manifest.Port{
Balancer: 443,
Container: 4001,
Public: true,
})
}
m.Services[e.Name] = me
}
data, err := yaml.Marshal(m)
if err != nil {
return err
}
// write the generated docker-compose.yml and return
return writeFile("docker-compose.yml", data, 0644)
}
// write the default if we get here
return writeAsset("docker-compose.yml", def)
}
开发者ID:convox,项目名称:rack,代码行数:56,代码来源:init.go
示例3: TestTag
func TestTag(t *testing.T) {
s := manifest.Service{
Name: "foo",
}
assert.Equal(t, s.Tag("api"), "api/foo")
s = manifest.Service{
Name: "foo_bar",
}
assert.Equal(t, s.Tag("api"), "api/foo-bar")
}
开发者ID:convox,项目名称:rack,代码行数:11,代码来源:service_test.go
示例4: TestNetworkName
func TestNetworkName(t *testing.T) {
networks := manifest.Networks{
"foo": manifest.InternalNetwork{
"external": manifest.ExternalNetwork{
Name: "foonet",
},
},
}
s := manifest.Service{
Networks: networks,
}
assert.Equal(t, s.NetworkName(), "foonet")
}
开发者ID:convox,项目名称:rack,代码行数:15,代码来源:service_test.go
示例5: TestLabelsByPrefix
func TestLabelsByPrefix(t *testing.T) {
labels := manifest.Labels{
"foofake": "label",
"foo_foo": "under_bar",
"foo-bar": "hypen-string",
"te-st": "hypen-string",
"bahtest": "hypen-string",
}
s := manifest.Service{
Labels: labels,
}
prefixed := s.LabelsByPrefix("foo")
assert.Equal(t, map[string]string{
"foofake": "label",
"foo_foo": "under_bar",
"foo-bar": "hypen-string",
}, prefixed)
}
开发者ID:convox,项目名称:rack,代码行数:21,代码来源:service_test.go
注:本文中的github.com/convox/rack/manifest.Service类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论