From 3365485720a68f27d237aedd35354de8ff186b47 Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Mon, 11 Nov 2019 18:14:16 -0500 Subject: [PATCH] Use env.fetch and default to `master` branch --- lib/micropub/github.rb | 2 +- lib/micropub/webserver.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/micropub/github.rb b/lib/micropub/github.rb index 786588e..35af077 100644 --- a/lib/micropub/github.rb +++ b/lib/micropub/github.rb @@ -24,7 +24,7 @@ module Micropub path: path, message: "Posting a post", content: post.post_content, - branch: "api_test", + branch: ENV.fetch("GITHUB_BRANCH", "master"), ) end diff --git a/lib/micropub/webserver.rb b/lib/micropub/webserver.rb index e4d51bc..2ca2e29 100644 --- a/lib/micropub/webserver.rb +++ b/lib/micropub/webserver.rb @@ -10,7 +10,7 @@ module Micropub github = Github.new - endpoints = Indieauth::Endpoints.new(ENV["SITE_URL"]) + endpoints = Indieauth::Endpoints.new(ENV.fetch("SITE_URL")) token = Indieauth::Token.new(endpoints.token_endpoint) get '/' do @@ -24,7 +24,7 @@ module Micropub end post "/micropub/main" do - if token.validate(ENV["INDIEAUTH_TOKEN"]) + if token.validate(ENV.fetch("INDIEAUTH_TOKEN")) post = Post.new(params) if github.post!(post)