// Enforce ENV credentials for distributed setup such that we can create the first config.
ifglobalIsDistXL&&!globalIsEnvCreds{
logger.Fatal(uiErrInvalidCredentials(nil),"Unable to start the server in distrbuted mode. In distributed mode we require explicit credentials.")
// FIXME: This code should be removed in future releases and we should have mandatory
// check for ENVs credentials under distributed setup. Until all users migrate we
// are intentionally providing backward compatibility.
{
// Check for backward compatibility and newer style.
if!globalIsEnvCreds&&globalIsDistXL{
// Try to load old config file if any, for backward compatibility.
varconfig=&serverConfig{}
if_,err=Load(getConfigFile(),config);err==nil{
globalActiveCred=config.Credential
}
ifglobalActiveCred.IsValid(){
// Credential is valid don't throw an error instead print a message regarding deprecation of 'config.json'
// based model and proceed to use it for now in distributed setup.
logger.Info(`Supplying credentials from your 'config.json' is **DEPRECATED**, Access key and Secret key in distributed server mode is expected to be specified with environment variables MINIO_ACCESS_KEY and MINIO_SECRET_KEY. This approach will become mandatory in future releases, please migrate to this approach soon.`)
}else{
// Credential is not available anywhere by both means, we cannot start distributed setup anymore, fail eagerly.
logger.Fatal(uiErrEnvCredentialsMissingServer(nil),"Unable to initialize distributed Minio server.")