Compare commits
2 commits
master
...
decomissio
Author | SHA1 | Date | |
---|---|---|---|
a63d5ae6f9 | |||
a179fb66c5 |
|
@ -111,7 +111,7 @@ const consolePrefix = "CONSOLE_"
|
|||
func minioConfigToConsoleFeatures() {
|
||||
os.Setenv("CONSOLE_PBKDF_SALT", globalDeploymentID)
|
||||
os.Setenv("CONSOLE_PBKDF_PASSPHRASE", globalDeploymentID)
|
||||
os.Setenv("CONSOLE_MINIO_SERVER", getAPIEndpoints()[0])
|
||||
os.Setenv("CONSOLE_MINIO_SERVER", globalMinioEndpoint)
|
||||
if value := env.Get("MINIO_LOG_QUERY_URL", ""); value != "" {
|
||||
os.Setenv("CONSOLE_LOG_QUERY_URL", value)
|
||||
if value := env.Get("MINIO_LOG_QUERY_AUTH_TOKEN", ""); value != "" {
|
||||
|
|
49
cmd/endpoint-v2.go
Normal file
49
cmd/endpoint-v2.go
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) 2015-2021 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/pkg/ellipses"
|
||||
)
|
||||
|
||||
var (
|
||||
globalMinioDrives string
|
||||
)
|
||||
|
||||
const (
|
||||
driveSeparator = "drives="
|
||||
)
|
||||
|
||||
func parseDrives(cctx *cli.Context) (string, error) {
|
||||
if !strings.Contains(cctx.Args().First(), driveSeparator) {
|
||||
return "", nil
|
||||
}
|
||||
tokens := strings.SplitN(cctx.Args().First(), driveSeparator, 2)
|
||||
if len(tokens) != 2 {
|
||||
return "", fmt.Errorf("unable to parse input args %s", cctx.Args())
|
||||
}
|
||||
drives := strings.TrimSpace(tokens[1])
|
||||
if !ellipses.HasEllipses(drives) {
|
||||
return "", fmt.Errorf("unable to parse input args %s, only allows ellipses patterns", cctx.Args())
|
||||
}
|
||||
return drives, nil
|
||||
}
|
|
@ -444,8 +444,16 @@ func serverMain(ctx *cli.Context) {
|
|||
erasureSelfTest()
|
||||
compressSelfTest()
|
||||
|
||||
// Handle all server command args.
|
||||
serverHandleCmdArgs(ctx)
|
||||
drives, err := parseDrives(ctx)
|
||||
if err != nil {
|
||||
logger.Fatal(config.ErrUnexpectedError(err), "Unable to parse the input arguments")
|
||||
}
|
||||
if drives == "" {
|
||||
// Handle all server command args.
|
||||
serverHandleCmdArgs(ctx)
|
||||
} else {
|
||||
globalMinioDrives = drives
|
||||
}
|
||||
|
||||
// Handle all server environment vars.
|
||||
serverHandleEnvVars()
|
||||
|
|
65
cmd/volume-meta.go
Normal file
65
cmd/volume-meta.go
Normal file
|
@ -0,0 +1,65 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/pkg/ellipses"
|
||||
)
|
||||
|
||||
func expandDriveVolumeMeta(driveArg string) (drives []string, err error) {
|
||||
patterns, err := ellipses.FindEllipsesPatterns(driveArg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, lbls := range patterns.Expand() {
|
||||
driveAbs, err := filepath.Abs(strings.Join(lbls, ""))
|
||||
if err != nil {
|
||||
// fail for non-absolute paths
|
||||
return nil, err
|
||||
}
|
||||
drives = append(drives, driveAbs)
|
||||
}
|
||||
return drives, nil
|
||||
}
|
||||
|
||||
type volumePool struct {
|
||||
ID string `json:"id"`
|
||||
Local string `json:"local"`
|
||||
Remote string `json:"remote"`
|
||||
CmdLine string `json:"cmdline"`
|
||||
}
|
||||
|
||||
type volumeMeta struct {
|
||||
Version string `json:"version"`
|
||||
Token string `json:"token"`
|
||||
Pools []volumePool `json:"pools"`
|
||||
}
|
||||
|
||||
const volumeMetaFile = "volume.meta"
|
||||
|
||||
func checkDriveVolumeMeta(driveArg string) (*volumeMeta, error) {
|
||||
drives, err := expandDriveVolumeMeta(driveArg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
volumeMetas := make([]*volumeMeta, len(drives))
|
||||
for i, drv := range drives {
|
||||
buf, err := ioutil.ReadFile(filepath.Join(drv, minioMetaBucket, volumeMetaFile))
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
var vm = new(volumeMeta)
|
||||
if err = json.Unmarshal(buf, vm); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
volumeMetas[i] = vm
|
||||
}
|
||||
return volumeMetas[0], nil
|
||||
}
|
Loading…
Reference in a new issue