rename BONFIRE_FLAVOUR to FLAVOUR_PATH

This commit is contained in:
Mayel 2021-06-08 16:11:02 +02:00
parent 3cc12d9f77
commit bdc696e4a4
9 changed files with 21 additions and 20 deletions

View file

@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
env:
FLAVOUR: coordination
BONFIRE_FLAVOUR: flavours/coordination
FLAVOUR_PATH: flavours/coordination
DOCKER_REPO: bonfire-with-valueflows-api
steps:
-
@ -87,7 +87,8 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
env:
BONFIRE_FLAVOUR: config
FLAVOUR: coordination
FLAVOUR_PATH: config
with:
context: .
file: Dockerfile.release

View file

@ -17,12 +17,12 @@ ARG ALPINE_VERSION=3.13
ARG APP_NAME
# The version of the application we are building (required)
ARG APP_VSN
ARG BONFIRE_FLAVOUR
ARG FLAVOUR_PATH
# Step 1 - Build our app
FROM elixir:${ELIXIR_VERSION}-alpine as builder
ENV HOME=/opt/app/ TERM=xterm MIX_ENV=prod BONFIRE_FLAVOUR=$BONFIRE_FLAVOUR APP_NAME=$APP_NAME
ENV HOME=/opt/app/ TERM=xterm MIX_ENV=prod FLAVOUR_PATH=$FLAVOUR_PATH APP_NAME=$APP_NAME
WORKDIR $HOME

View file

@ -5,7 +5,7 @@ BASH := $(shell which bash)
# what flavour do we want?
FLAVOUR ?= classic
BONFIRE_FLAVOUR ?= flavours/$(FLAVOUR)
FLAVOUR_PATH ?= flavours/$(FLAVOUR)
# do we want to use Docker? set as env var:
# - WITH_DOCKER=total : use docker for everything (default)
@ -34,7 +34,7 @@ export UID
export GID
define setup_env
$(eval ENV_DIR := $(BONFIRE_FLAVOUR)/config/$(1))
$(eval ENV_DIR := $(FLAVOUR_PATH)/config/$(1))
@echo "Loading environment variables from $(ENV_DIR)"
@$(call load_env,$(ENV_DIR)/public.env)
@$(call load_env,$(ENV_DIR)/secrets.env)
@ -50,7 +50,7 @@ pre-config: pre-init ## Initialise env files, and create some required folders,
@echo "You can now edit your config for flavour '$(FLAVOUR)' in config/dev/secrets.env, config/dev/public.env and ./config/ more generally."
pre-init:
@ln -sfn $(BONFIRE_FLAVOUR)/config ./config
@ln -sfn $(FLAVOUR_PATH)/config ./config
@mkdir -p config/prod
@mkdir -p config/dev
@touch config/deps.path
@ -74,7 +74,7 @@ help: init ## Makefile commands help
@perl -nle'print $& if m{^[a-zA-Z_-~.%]+:.*?## .*$$}' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
env.exports: ## Display the vars from dotenv files that you need to load in your environment
@awk 'NF { if( $$1 != "#" ){ print "export " $$0 }}' $(BONFIRE_FLAVOUR)/config/dev/*.env
@awk 'NF { if( $$1 != "#" ){ print "export " $$0 }}' $(FLAVOUR_PATH)/config/dev/*.env
#### COMMON COMMANDS ####
@ -125,7 +125,7 @@ update.deps.all: ## Update evey single dependency (use with caution)
update.dep~%: ## Update a specify dep (eg. `make update.dep~pointers`)
@make --no-print-directory mix.remote~"deps.update $*"
@chmod +x git-publish.sh
./git-publish.sh $(FORKS_PATH)/$*
./git-publish.sh $(FORKS_PATH)/$* pull
update.forks: git.forks~pull ## Pull the latest commits from all ./forks
@ -260,12 +260,12 @@ endif
#### RELEASE RELATED COMMANDS (Docker-specific for now) ####
rel.config.prepare: # copy current flavour's config, without using symlinks
cp -rfL $(BONFIRE_FLAVOUR)/config ./data/config
cp -rfL $(FLAVOUR_PATH)/config ./data/config
rel.build.no-cache: init rel.config.prepare assets.prepare ## Build the Docker image
docker build \
--no-cache \
--build-arg BONFIRE_FLAVOUR=config \
--build-arg FLAVOUR_PATH=config \
--build-arg APP_NAME=$(APP_NAME) \
--build-arg APP_VSN=$(APP_VSN) \
--build-arg APP_BUILD=$(APP_BUILD) \
@ -275,7 +275,7 @@ rel.build.no-cache: init rel.config.prepare assets.prepare ## Build the Docker i
rel.build: init rel.config.prepare assets.prepare ## Build the Docker image using previous cache
docker build \
--build-arg BONFIRE_FLAVOUR=config \
--build-arg FLAVOUR_PATH=config \
--build-arg APP_NAME=$(APP_NAME) \
--build-arg APP_VSN=$(APP_VSN) \
--build-arg APP_BUILD=$(APP_BUILD) \

View file

@ -1,8 +1,8 @@
import Config
default_flavour = "classic"
flavour_path = System.get_env("BONFIRE_FLAVOUR", "flavours/"<>System.get_env("FLAVOUR", default_flavour))
flavour = System.get_env("FLAVOUR", flavour_path |> String.split("/") |> List.last())
flavour = System.get_env("FLAVOUR", default_flavour)
flavour_path = System.get_env("FLAVOUR_PATH", "flavours/"<>flavour)
#### Basic configuration

View file

@ -1,5 +1,4 @@
FLAVOUR=classic
BONFIRE_FLAVOUR=flavours/classic
# COPY this file to /config/{dev|prod}/public.env and change any values as required
# server domain name:
HOSTNAME=localhost

View file

@ -1,5 +1,4 @@
FLAVOUR=coordination
BONFIRE_FLAVOUR=flavours/coordination
# COPY this file to /config/{dev|prod}/public.env and change any values as required
# server domain name:
HOSTNAME=localhost

View file

@ -1,5 +1,4 @@
FLAVOUR=reflow
BONFIRE_FLAVOUR=flavours/reflow
# COPY this file to /config/{dev|prod}/public.env and change any values as required
# server domain name:
HOSTNAME=localhost

View file

@ -28,5 +28,8 @@ then
else
set -e
#echo No local changes since last run
#git pull
if [ $2 == 'pull' ]
then
git pull
fi
fi

View file

@ -105,10 +105,10 @@ defmodule Bonfire.MixProject do
Enum.filter(deps, &include_dep?(deps_subtype, &1))
def flavour_path(), do:
System.get_env("BONFIRE_FLAVOUR", "flavours/"<>System.get_env("FLAVOUR", @config[:default_flavour]))
System.get_env("FLAVOUR_PATH", "flavours/"<>flavour())
def flavour(), do:
System.get_env("FLAVOUR", flavour_path() |> String.split("/") |> List.last())
System.get_env("FLAVOUR", @config[:default_flavour])
def config_path(flavour_path \\ flavour_path(), filename),
do: Path.expand(Path.join([flavour_path, "config", filename]))