Class: Kitsune::Kit::Commands::SetupPostgresDocker

Inherits:
Thor
  • Object
show all
Defined in:
lib/kitsune/kit/commands/setup_postgres_docker.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/kitsune/kit/commands/setup_postgres_docker.rb', line 20

def create
  postgres_defaults = Kitsune::Kit::Defaults.postgres

  if postgres_defaults[:postgres_password] == "secret"
    say "⚠️ Warning: You are using the default PostgreSQL password ('secret').", :yellow
    if ENV.fetch("KIT_ENV", "development") == "production"
      abort "❌ Production environment requires a secure PostgreSQL password!"
    else
      say "🔒 Please change POSTGRES_PASSWORD in your .env if needed.", :yellow
    end
  end

  filled_options = Kitsune::Kit::OptionsBuilder.build(
    options,
    required: [:server_ip],
    defaults: Kitsune::Kit::Defaults.ssh
  )

  with_ssh_connection(filled_options) do |ssh|
    perform_setup(ssh, postgres_defaults, filled_options)
  end
end

#rollbackObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/kitsune/kit/commands/setup_postgres_docker.rb', line 44

def rollback
  postgres_defaults = Kitsune::Kit::Defaults.postgres

  filled_options = Kitsune::Kit::OptionsBuilder.build(
    options,
    required: [:server_ip],
    defaults: Kitsune::Kit::Defaults.ssh
  )

  with_ssh_connection(filled_options) do |ssh|
    perform_rollback(ssh, postgres_defaults)
  end
end