Fix dotenv load

This commit is contained in:
Ari Timonen 2020-04-05 06:30:14 +03:00
parent 75b33e760a
commit 14d087b913
6 changed files with 8 additions and 49 deletions

View file

@ -22,14 +22,11 @@ Now create the required directories, e.g. `/srv/ensl.org`
git clone git@github.com:ENSL/ensl.org.git
Create the `.env` file by copying `.env.example` with the appropriate credentials.
First select your environment (eg. development). Then use a script to load the env vars to your shell env:
cd ensl.org && cp .env.example .env
gedit .env
source script/env.sh .env .env.development
If the database does not exist, it will be created with settings from .env file so make sure you configure it.
First build the ENSL docker containers.
Second build the ENSL docker containers.
docker-compose build

View file

@ -1,37 +0,0 @@
#REGISTRY ?= ensl
PROJECT ?= ensl-plugin
TAG ?= latest
.PHONY: all test clean build
ifdef REGISTRY
IMAGE=$(REGISTRY)/$(PROJECT):$(TAG)
else
IMAGE=$(PROJECT)
endif
all:
@echo "Available targets:"
@echo " * build - build a Docker image for $(IMAGE)"
@echo " * pull - pull $(IMAGE)"
@echo " * push - push $(IMAGE)"
@echo " * test - build and test $(IMAGE)"
build:
docker-compose build -f docker-compose.dev.yml
run: build
docker-compose up -f docker-compose.dev.yml
pull:
docker pull $(IMAGE) || true
push:
docker push $(IMAGE)
clean:
docker ps -a | awk '{ print $$1,$$2 }' | grep $(IMAGE) |awk '{print $$1 }' |xargs -I {} docker rm {}
docker images -a |grep $(IMAGE) |awk '{print $$3}' |xargs -I {} docker rmi {}
test: build
@echo "TODO"

View file

@ -1,7 +1,6 @@
# Load dev vars
# FIXME: right dev file is not loaded
# Load dev vars. These are loaded in application but puma needs them too.
require "dotenv"
Dotenv.load(".env.local", '.env' + ENV['RAILS_ENV'] + '.local', '.env' + ENV['RAILS_ENV'], '.env')
Dotenv.load('.env.' + ENV['RAILS_ENV'] + '.local', '.env.local', '.env.' + ENV['RAILS_ENV'], '.env')
tag 'ENSL'

View file

@ -107,8 +107,8 @@ services:
nginx:
image: nginx:latest
command: /bin/bash
container_name: ensl_${RAILS_ENV}_nginx
command: /bin/bash -c "envsubst '$$PUMA_PORT' < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
volumes:
- ./ext/ssl/fullchain.pem:/etc/ssl/certs/ensl_fullchain.pem
- ./ext/ssl/privkey.pem:/etc/ssl/private/ensl_privkey.pem
@ -122,7 +122,6 @@ services:
- APP_PORT=$APP_PORT
- PUMA_PORT=$PUMA_PORT
- RAILS_ENV=$RAILS_ENV
# command: /bin/bash -c "envsubst '$$PUMA_PORT' < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
# spring:
# build:

View file

@ -1,6 +1,7 @@
ENV["RAILS_ENV"] ||= "test"
require 'dotenv/load'
require 'dotenv'
Dotenv.load('.env.' + ENV['RAILS_ENV'] + '.local', '.env.local', '.env.' + ENV['RAILS_ENV'], '.env')
require "codeclimate-test-reporter"
require "simplecov"