diff options
author | Paul Duncan <pabs@pablotron.org> | 2025-05-18 07:59:17 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2025-05-18 07:59:17 -0400 |
commit | 07ae6c3b7a4af1a8ea08fbe5d511e4486d242676 (patch) | |
tree | 31aa4019a85a014c1f7de7bf65a8e851fb444351 | |
parent | 2f0f911def1e0bad53220c3288bac30b5b98bf14 (diff) | |
download | pablotron.org-07ae6c3b7a4af1a8ea08fbe5d511e4486d242676.tar.xz pablotron.org-07ae6c3b7a4af1a8ea08fbe5d511e4486d242676.zip |
bin/hook/deploy.rb: add DEPLOY_BASE_URL env var
-rwxr-xr-x | bin/hook/deploy.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/hook/deploy.rb b/bin/hook/deploy.rb index e7fcc1f..839b454 100755 --- a/bin/hook/deploy.rb +++ b/bin/hook/deploy.rb @@ -26,6 +26,9 @@ # timestamp. # * `DEPLOY_BUILD_CACHE_SIZE`: Optional, defaults to 5 if unspecified. # Number of old site builds to keep in the builds directory. +# * `DEPLOY_BASE_URL`: Optional, defaults to `baseURL` from +# `config.toml` if unspecified. Used to override the base URL for +# onion service deployment. # # load libraries @@ -54,6 +57,11 @@ NUM_SECONDS = ENV.fetch('DEPLOY_SKEW_THRESHOLD', '300').to_i # number of site builds to keep in builds directory BUILD_CACHE_SIZE = ENV.fetch('DEPLOY_BUILD_CACHE_SIZE', '5').to_i +# base URL: optional, defaults to baseURL from config.toml if +# unspecified. used to override the base URL for onion service +# deployment. +BASE_URL = ENV.fetch('DEPLOY_BASE_URL', '') + # command paths (optional) FLOCK = ENV.fetch('DEPLOY_FLOCK_PATH', '/usr/bin/flock') GIT = ENV.fetch('DEPLOY_GIT_PATH', '/usr/bin/git') @@ -121,9 +129,18 @@ pull_time = timed do run(FLOCK, SRC_DIR, GIT, 'pull', '--rebase') end +# build hugo command +hugo_cmd = if BASE_URL.length > 0 + # hugo command with custom base URL + [HUGO, '--minify', '-b', BASE_URL, '-d', DST_DIR] +else + # default hugo command + [HUGO, '--minify', '-d', DST_DIR] +end + # build site hugo_time = timed do - run(HUGO, '--minify', '-d', DST_DIR) + run(*hugo_cmd) end # update htdocs symlink |