Sha256: f3a367dcfc26cdf4852654559d15216af5cb0f562bcd21703277a6186d4283ba

Contents?: true

Size: 1.66 KB

Versions: 14

Compression:

Stored size: 1.66 KB

Contents

# Copyright:: Copyright (c) 2020 eGlobalTech, Inc., all rights reserved
#
# Licensed under the BSD-3 license (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the root of the project or at
#
#     http://egt-labs.com/mu/LICENSE.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module MU
  # Plugins under this namespace serve as interfaces to cloud providers and
  # other provisioning layers.
  class Cloud

    # Generic methods for all Database implementations
    class Database

      # Getting the password for a database's master user, and saving it in a database / cluster specific vault
      def getPassword
        if @config['password'].nil?
          if @config['auth_vault'] && !@config['auth_vault'].empty?
            @config['password'] = @groomclass.getSecret(
              vault: @config['auth_vault']['vault'],
              item: @config['auth_vault']['item'],
              field: @config['auth_vault']['password_field']
            )
          else
            # Should we use random instead?
            @config['password'] = Password.pronounceable(10..12)
          end
        end
  
        creds = {
          "username" => @config["master_user"],
          "password" => @config["password"]
        }
        @groomclass.saveSecret(vault: @mu_name, item: "database_credentials", data: creds)
      end

    end

  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cloud-mu-3.6.10 modules/mu/cloud/database.rb
cloud-mu-3.6.9 modules/mu/cloud/database.rb
cloud-mu-3.6.8 modules/mu/cloud/database.rb
cloud-mu-3.6.7 modules/mu/cloud/database.rb
cloud-mu-3.6.5 modules/mu/cloud/database.rb
cloud-mu-3.6.4 modules/mu/cloud/database.rb
cloud-mu-3.6.3 modules/mu/cloud/database.rb
cloud-mu-3.5.1 modules/mu/cloud/database.rb
cloud-mu-3.5.0 modules/mu/cloud/database.rb
cloud-mu-3.4.0 modules/mu/cloud/database.rb
cloud-mu-3.3.2 modules/mu/cloud/database.rb
cloud-mu-3.3.1 modules/mu/cloud/database.rb
cloud-mu-3.3.0 modules/mu/cloud/database.rb
cloud-mu-3.2.0 modules/mu/cloud/database.rb