File tree Expand file tree Collapse file tree 2 files changed +27
-33
lines changed Expand file tree Collapse file tree 2 files changed +27
-33
lines changed Original file line number Diff line number Diff line change @@ -59,35 +59,6 @@ Some other adjustments must be performed manually.
5959
6060> ⭐️bin/check, bin/fastcheck and bin/run are standardized tools for more convenience at Renuo.
6161
62- ### Manual adjustments
63-
64- Please perform these adjustments manually:
65-
66- #### ENV variables
67-
68- * Add ` dotenv-rails ` to Gemfile. Check the [ gem homepage] ( https://github.com/bkeepers/dotenv ) to see how to install the gem.
69- * and create ` .env.example ` in the root folder of the project where you will specify the only environment variable you need for now:
70- ` SECRET_KEY_BASE ` .
71- * Going forward we will only push the ` .env.example ` file to the repository in order to protect our env variables.
72- * Add .env to .gitignore
73- * Add the following section to your ` bin/setup ` script so that the ` .env ` is created from the ` .env ` when the project is setup locally:
74-
75- ``` ruby
76- puts " \n == Copying sample files =="
77- unless File .exist?(' .env' )
78- system! ' cp .env.example .env'
79- end
80- ```
81-
82- * add one more key to .env.example ` APP_PORT=3000 `
83- * To ensure you have all the required keys from the ` .env.example ` in your ` .env ` ,
84- create the initializer for dotenv-rails in ` config/initializers/dotenv_rails.rb ` :
85-
86- ``` ruby
87- Dotenv .require_keys(Dotenv .parse(" .env.example" ).keys)
88- ```
89-
90- * Run ` bin/setup ` again.
9162
9263### Secrets
9364
Original file line number Diff line number Diff line change 1717# replace bin/rails db:prepare with bin/rails db:setup in bin/setup
1818gsub_file "bin/setup" , "bin/rails db:prepare" , "bin/rails db:setup"
1919
20- # add the renuo fetch-secrets command in bin/setup, before bin/rails db:setup
20+ # add the renuo fetch-secrets command and copying the dotenv file in bin/setup, before bin/rails db:setup
2121insert_into_file "bin/setup" , before : "\n puts \" \\ n== Preparing database ==\" " do
2222 <<-RUBY
2323 puts "\\ n== Fetching 1password dependencies =="
24- system! 'renuo fetch-secrets'
24+ system! 'renuo fetch-secrets'
25+
26+ puts "\n == Copying sample files =="
27+ unless File.exist?('.env')
28+ system! 'cp .env.example .env'
29+ end
2530 RUBY
2631end
2732
4348 RUBOCOP
4449end
4550
46- create_file ".env.example" , force : true
47- create_file ".env" , force : true
51+
52+ create_file ".env.example" , force : true do
53+ <<~ENV
54+ SECRET_KEY_BASE=<%= `bin/rails secret`.strip %>
55+ APP_PORT=3000
56+ ENV
57+ end
58+
59+ create_file ".env" , force : true do
60+ <<~ENV
61+ SECRET_KEY_BASE=#{ `bin/rails secret` . strip }
62+ APP_PORT=3000
63+ ENV
64+ end
65+
66+ create_file "config/initializers/dotenv.rb" , force : true do
67+ <<~DOTENV
68+ Dotenv.require_keys(Dotenv.parse(".env.example").keys)
69+ DOTENV
70+ end
4871
4972create_file "bin/run" , force : true do
5073 <<~RUN
You can’t perform that action at this time.
0 commit comments