Sha256: ed12c169aa2b567c0e61a1910879db9ca5690e6ab727710965a0b79771403ce6

Contents?: true

Size: 552 Bytes

Versions: 30

Compression:

Stored size: 552 Bytes

Contents

module Litestream
  class RestorationsController < ApplicationController
    # POST /restorations
    def create
      database = params[:database].remove("[ROOT]/")
      dir, file = File.split(database)
      ext = File.extname(file)
      base = File.basename(file, ext)
      now = Time.now.utc.strftime("%Y%m%d%H%M%S")
      backup = File.join(dir, "#{base}-#{now}#{ext}")

      Litestream::Commands.restore(database, async: false, **{"-o" => backup})

      redirect_to root_path, notice: "Restored to <code>#{backup}</code>."
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
litestream-0.12.0 app/controllers/litestream/restorations_controller.rb
litestream-0.12.0-x86_64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.12.0-x86_64-darwin app/controllers/litestream/restorations_controller.rb
litestream-0.12.0-arm64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.12.0-arm64-darwin app/controllers/litestream/restorations_controller.rb
litestream-0.11.2 app/controllers/litestream/restorations_controller.rb
litestream-0.11.2-x86_64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.11.2-x86_64-darwin app/controllers/litestream/restorations_controller.rb
litestream-0.11.2-arm64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.11.2-arm64-darwin app/controllers/litestream/restorations_controller.rb
litestream-0.11.1-x86_64-darwin app/controllers/litestream/restorations_controller.rb
litestream-0.11.1 app/controllers/litestream/restorations_controller.rb
litestream-0.11.1-x86_64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.11.1-arm64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.11.1-arm64-darwin app/controllers/litestream/restorations_controller.rb
litestream-0.11.0 app/controllers/litestream/restorations_controller.rb
litestream-0.11.0-x86_64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.11.0-x86_64-darwin app/controllers/litestream/restorations_controller.rb
litestream-0.11.0-arm64-linux app/controllers/litestream/restorations_controller.rb
litestream-0.11.0-arm64-darwin app/controllers/litestream/restorations_controller.rb