11# Staging Environment Protection
22
3+ HTTP Basic Authentication should be configured to prevent public traffic on our development applications.
4+
35## Configuration for Heroku
46
5- Add
7+ With Heroku, basic auth can be configured as follows:
68
7- ``` bash
8- # BASIC_AUTH="admin:some-memorable-password"
9- ` ` ` to ` .env.example` , then run the following command:
9+ Add ` # BASIC_AUTH: 'admin:some-memorable-password' ` to ` application.example.yml ` , then run the following command:
1010
1111``` sh
1212heroku config:set BASIC_AUTH=' admin:[first-memorable-password]' --app [your-app]-develop
@@ -15,31 +15,13 @@ Finally, save the passwords in 1Password.
1515
1616## Configuration for Deploio
1717
18- HTTP Basic Authentication should be configured to prevent public traffic on our development applications.
19-
20- With Deploio, configure Basic Auth in the Rails app:
21-
22- ### Managing Basic Auth via Rails
23-
24- To manage Basic Auth via Rails, use the following commands:
18+ On Deploio, basic auth can be configured in the following way:
2519
2620``` sh
27- nctl config set --project {PROJECT_NAME} --application {APPLICATION_NAME} --env=BASIC_AUTH={USERNAME}:{PASSWORD}
28- nctl config set --project {PROJECT_NAME} --application {APPLICATION_NAME} --basic-auth false
21+ nctl update app {APPLICATION_NAME} --project {PROJECT_NAME} --basic-auth=true
2922```
3023
31- ## ApplicationController Configuration
32-
33- Configure the ` ApplicationController ` like this when managing Basic Auth via Rails:
34-
35- ``` ruby
36- class ApplicationController < ActionController ::Base
37- # ...
38-
39- ENV [' BASIC_AUTH' ].to_s.split(' :' ).presence&.then do |username , password |
40- http_basic_authenticate_with name: username, password: password
41- end
42-
43- # ...
44- end
24+ Credentials can be changed like this:
25+ ``` sh
26+ nctl update app {APPLICATION_NAME} --project {PROJECT_NAME} --change-basic-auth-password
4527```
0 commit comments