From 9637de110e2560fd2c442485e237301186e236f2 Mon Sep 17 00:00:00 2001 From: Daniel Valdivia Date: Wed, 1 Apr 2020 19:04:33 -0700 Subject: [PATCH] Missing cmd file --- .gitignore | 1 + cmd/mcs-server/main.go | 73 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 cmd/mcs-server/main.go diff --git a/.gitignore b/.gitignore index be0947b53..a9b8827f9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ vendor/ # Ignore executables target/ mcs-server +!mcs-server/ diff --git a/cmd/mcs-server/main.go b/cmd/mcs-server/main.go new file mode 100644 index 000000000..5bf5d679e --- /dev/null +++ b/cmd/mcs-server/main.go @@ -0,0 +1,73 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// This file is part of MinIO Console Server +// Copyright (c) 2020 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// + +package main + +import ( + "log" + "os" + + "github.com/go-openapi/loads" + flags "github.com/jessevdk/go-flags" + "github.com/minio/m3/mcs/restapi" + "github.com/minio/m3/mcs/restapi/operations" +) + +// This file was generated by the swagger tool. +// Make sure not to overwrite this file after you generated it because all your edits would be lost! + +func main() { + + swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON) + if err != nil { + log.Fatalln(err) + } + + api := operations.NewMcsAPI(swaggerSpec) + server := restapi.NewServer(api) + defer server.Shutdown() + + parser := flags.NewParser(server, flags.Default) + parser.ShortDescription = "MinIO Console Server" + parser.LongDescription = swaggerSpec.Spec().Info.Description + server.ConfigureFlags() + for _, optsGroup := range api.CommandLineOptionsGroups { + _, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options) + if err != nil { + log.Fatalln(err) + } + } + + if _, err := parser.Parse(); err != nil { + code := 1 + if fe, ok := err.(*flags.Error); ok { + if fe.Type == flags.ErrHelp { + code = 0 + } + } + os.Exit(code) + } + + server.ConfigureAPI() + + if err := server.Serve(); err != nil { + log.Fatalln(err) + } + +}