# This initializer is used by Rake and Capistrano to help generating the
# localconfig.php file, it stores basically the encrypted install password,
# the encryption_key and the SMTP credentials if SMTP is enabled

module ContaoTemplate
  class Application < Rails::Application
    # The install password is used by /contao/install.php page
    config.contao.install_password = '<%= config.install_password %>'

    # The encryption key is used by extensions
    config.contao.encryption_key = '<%= config.encryption_key %>'

    # The admin email
    config.contao.admin_email = '<%= config.admin_email %>'

    # The time zone
    config.contao.time_zone = '<%= config.time_zone %>'

    # SMTP Configuration
    # Configure contao to use an SMTP server

    # Enable SMTP ?
    config.contao.smtp.enabled = <%= config.smtp_enabled %>
    <%- if config.smtp_enabled %>
    # SMTP Host
    config.contao.smtp.host = '<%= config.smtp_host %>'

    # SMTP User
    config.contao.smtp.user = '<%= config.smtp_user %>'

    # SMTP Pass
    config.contao.smtp.pass = '<%= config.smtp_pass %>'

    # SMTP SSL
    config.contao.smtp.ssl = <%= config.smtp_ssl %>

    # SMTP Port
    config.contao.smtp.port = <%= config.smtp_port %>
    <%- end %>
  end
end

# This initializer is used by Rake and Capistrano to help generating the
# localconfig.php file, it stores basically the encrypted install password,
# the encryption_key and the SMTP credentials if SMTP is enabled

module ContaoTemplate
  class Application < Rails::Application
    if config.respond_to? :contao

      # The install password is used by /contao/install.php page
      config.contao.install_password = '<%= config.install_password %>'

      # The encryption key is used by extensions
      config.contao.encryption_key = '<%= config.encryption_key %>'

      # The admin email
      config.contao.admin_email = '<%= config.admin_email %>'

      # The time zone
      config.contao.time_zone = '<%= config.time_zone %>'

      # SMTP Configuration
      # Configure contao to use an SMTP server

      # Enable SMTP ?
      config.contao.smtp.enabled = <%= config.smtp_enabled %>
      <%- if config.smtp_enabled %>
      # SMTP Host
      config.contao.smtp.host = '<%= config.smtp_host %>'

      # SMTP User
      config.contao.smtp.user = '<%= config.smtp_user %>'

      # SMTP Pass
      config.contao.smtp.pass = '<%= config.smtp_pass %>'

      # SMTP SSL
      config.contao.smtp.ssl = <%= config.smtp_ssl %>

      # SMTP Port
      config.contao.smtp.port = <%= config.smtp_port %>
      <%- end %>

    end
  end
end

Configure contao only if the configuration key exists
Configure contao only if the configuration key exists
