Skip to content

Commit

Permalink
Add DotEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya N. Zykin committed Feb 23, 2023
1 parent 8a519dd commit 1a7c0e6
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# DotEnv file for All Environments
#
# It is added to the repo to provide most common and required ENV vars
# To demonstrate a full list of variables that we need for the application
#
# `config/credentials.yml.enc` and `/config/master.key` were deleted
# `Rails7. StartKit` does not rely on them for now
#
RAILS_VERSION=7.0.4.2
SECRET_KEY_BASE=abracadabra
ENV_NAME=unknown

REDIS_HOST=redis
REDIS_PORT=6379

ELASTIC_HOST=elastic
ELASTIC_PORT=9200
5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DotEnv file for `development` environment
#
# This file should redefine `.env` and setup environment specific values
#
ENV_NAME=development
5 changes: 5 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DotEnv file for `production` environment
#
# This file should redefine `.env` and setup environment specific values
#
ENV_NAME=production
4 changes: 4 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DotEnv file for `test` environment
#
# This file should redefine `.env` and setup environment specific values
ENV_NAME=test
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ config/environments/*.local.yml

# gem SimpleCov
coverage

# Dot Env gem
/.env.local
/.env.test.local
/.env.development.local
/.env.production.local
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.2.1"

# Rails7. Start Kit
# env variables
gem "dotenv-rails", "2.8.1", require: "dotenv/rails-now"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "7.0.4.2"

Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.5.0)
docile (1.4.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
dry-configurable (1.0.1)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
Expand Down Expand Up @@ -362,6 +366,7 @@ DEPENDENCIES
config (= 4.1.0)!
debug (= 1.7.1)
devise (= 4.8.1)
dotenv-rails (= 2.8.1)
faker (= 3.1.0)
importmap-rails (= 1.1.5)
jbuilder (= 2.11.5)
Expand Down
10 changes: 5 additions & 5 deletions config/_CONFIG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
# Settings.app.rails.version
app:
rails:
version: "7"
version: <%= ENV['RAILS_VERSION'] %>

redis:
host: redis
port: 6379
host: <%= ENV['REDIS_HOST'] %>
port: <%= ENV['REDIS_PORT'] %>

elastic:
host: elastic
port: 9200
host: <%= ENV['ELASTIC_HOST'] %>
port: <%= ENV['ELASTIC_PORT'] %>
1 change: 0 additions & 1 deletion config/credentials.yml.enc

This file was deleted.

0 comments on commit 1a7c0e6

Please sign in to comment.