From 8a49e52a0185aa762b42f216d18b2f49696c6277 Mon Sep 17 00:00:00 2001 From: silsha fux Date: Sun, 4 Oct 2015 02:40:03 +0200 Subject: [PATCH 1/4] Check for HUGOCONFIG variable --- bin/detect | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/detect b/bin/detect index a8ef9e4..94c4b4a 100644 --- a/bin/detect +++ b/bin/detect @@ -2,9 +2,13 @@ BUILD_DIR=$1 -CONFIG_FILE="`ls $BUILD_DIR | grep config`" +if [ -z "$HUGOCONFIG" ]; then + CONFIG_FILE="`ls $BUILD_DIR | grep config | head -n1`" +else + CONFIG_FILE="$HUGOCONFIG" +fi -if [ -z $CONFIG_FILE ]; then +if [ -z "$CONFIG_FILE" ]; then echo "\n-----> Hugo expects to find a config file in the root of the source directory! please include a config.toml, config.yaml or config.json file" exit 1 fi From a53255295dc85512129cf6c2e73007b5185a3447 Mon Sep 17 00:00:00 2001 From: silsha fux Date: Sun, 4 Oct 2015 03:20:13 +0200 Subject: [PATCH 2/4] Use config variable while building --- bin/compile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 6acb5f0..5b59427 100644 --- a/bin/compile +++ b/bin/compile @@ -41,8 +41,15 @@ if [ -e $BUILD_DIR/.hugotheme ]; then git clone $THEME_URL fi +# Fetch config file +if [ -z "$HUGOCONFIG" ]; then + CONFIG_FILE="`ls $BUILD_DIR | grep config | head -n1`" +else + CONFIG_FILE="$HUGOCONFIG" +fi + # Build the site -echo "\n-----> Building the site" +echo "\n-----> Building the site with config file $CONFIG_FILE" cd $BUILD_DIR mkdir -p static | indent -./hugo | indent +./hugo --config="$CONFIG_FILE" | indent From 9f53b2b4528d8ecbff7f4d6554d992b5079b05c8 Mon Sep 17 00:00:00 2001 From: silsha fux Date: Sun, 4 Oct 2015 03:32:18 +0200 Subject: [PATCH 3/4] Support custom paths --- bin/release | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/release b/bin/release index 88f41e7..fa4e419 100644 --- a/bin/release +++ b/bin/release @@ -1,7 +1,10 @@ #!/bin/sh +if [ -z "$HUGOPATH" ]; then + HUGOPATH="public" +fi cat << EOF --- default_process_types: - web: "cd public && python -m SimpleHTTPServer \$PORT" + web: "cd \$HUGOPATH && python -m SimpleHTTPServer \$PORT" EOF From 25a80c9b326341a1f9ce275b7e432e43b4baa32b Mon Sep 17 00:00:00 2001 From: silsha fux Date: Sun, 4 Oct 2015 03:44:34 +0200 Subject: [PATCH 4/4] Add environment variables section to README --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index e2c9b68..70d5255 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,20 @@ $ git push heroku master $ heroku open ``` +Environment Variables +=== + +To use a custom config file name or `publishdir` you can use these environment variables: + +```bash +$ heroku config:set HUGOCONFIG="config_de.toml" +``` + +```bash +$ heroku config:set HUGOPATH="public/custom" +``` + + Legacy Compatibility ===