From edb277a815acca349c7e64284416feef26236060 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Mon, 11 Dec 2023 22:11:14 +0100 Subject: [PATCH] Add tasks to print out ENV variables and start the replication process --- lib/tasks/litestream_tasks.rake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/tasks/litestream_tasks.rake diff --git a/lib/tasks/litestream_tasks.rake b/lib/tasks/litestream_tasks.rake new file mode 100644 index 0000000..6a82023 --- /dev/null +++ b/lib/tasks/litestream_tasks.rake @@ -0,0 +1,21 @@ +namespace :litestream do + desc "Print the ENV variables needed for the Litestream config file" + task env: :environment do + if Litestream.configuration.nil? + warn "You have not configured the Litestream gem with any values to generate ENV variables" + next + end + + puts "LITESTREAM_DATABASE_PATH=#{Litestream.configuration.database_path}" + puts "LITESTREAM_REPLICA_URL=#{Litestream.configuration.replica_url}" + puts "LITESTREAM_REPLICA_KEY_ID=#{Litestream.configuration.replica_key_id}" + puts "LITESTREAM_REPLICA_ACCESS_KEY=#{Litestream.configuration.replica_access_key}" + + true + end + + desc "" + task replicate: :environment do + Litestream::Commands.replicate + end +end