2 Star 0 Fork 0

mirrors_rancher/rancher-compose

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 2.03 KB
一键复制 编辑 原始数据 按行查看 历史
rajashree 提交于 2016-09-12 11:49 . Bindings
package main
import (
"fmt"
"os"
"path"
"github.com/Sirupsen/logrus"
"github.com/docker/libcompose/cli/command"
rancherApp "github.com/rancher/rancher-compose/app"
"github.com/rancher/rancher-compose/executor"
"github.com/rancher/rancher-compose/version"
"github.com/urfave/cli"
)
func beforeApp(c *cli.Context) error {
if c.GlobalBool("verbose") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
}
func main() {
if path.Base(os.Args[0]) == "rancher-compose-executor" {
executor.Main()
} else {
cliMain()
}
}
func cliMain() {
factory := &rancherApp.ProjectFactory{}
app := cli.NewApp()
app.Name = "rancher-compose"
app.Usage = "Docker-compose to Rancher"
app.Version = version.VERSION
app.Author = "Rancher Labs, Inc."
app.Email = ""
app.Before = beforeApp
app.Flags = append(command.CommonFlags(),
cli.StringFlag{
Name: "url",
Usage: fmt.Sprintf(
"Specify the Rancher API endpoint URL",
),
EnvVar: "RANCHER_URL",
},
cli.StringFlag{
Name: "access-key",
Usage: fmt.Sprintf(
"Specify Rancher API access key",
),
EnvVar: "RANCHER_ACCESS_KEY",
},
cli.StringFlag{
Name: "secret-key",
Usage: fmt.Sprintf(
"Specify Rancher API secret key",
),
EnvVar: "RANCHER_SECRET_KEY",
},
cli.StringFlag{
Name: "rancher-file,r",
Usage: "Specify an alternate Rancher compose file (default: rancher-compose.yml)",
},
cli.StringFlag{
Name: "env-file,e",
Usage: "Specify a file from which to read environment variables",
},
cli.StringFlag{
Name: "bindings-file,b",
Usage: "Specify a file from which to read bindings",
},
)
app.Commands = []cli.Command{
rancherApp.CreateCommand(factory),
rancherApp.UpCommand(factory),
command.StartCommand(factory),
command.LogsCommand(factory),
rancherApp.RestartCommand(factory),
rancherApp.StopCommand(factory),
command.ScaleCommand(factory),
command.RmCommand(factory),
rancherApp.PullCommand(factory),
rancherApp.UpgradeCommand(factory),
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_rancher/rancher-compose.git
git@gitee.com:mirrors_rancher/rancher-compose.git
mirrors_rancher
rancher-compose
rancher-compose
master

搜索帮助