Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating application to use env vars for authentication instead of st… #17

Merged
merged 1 commit into from
Jun 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ArticlesController < ApplicationController

http_basic_authenticate_with name: "openshift", password: "secret", except: [:index, :show]
http_basic_authenticate_with name: ENV["APPLICATION_USER"], password: ENV["APPLICATION_PASSWORD"], except: [:index, :show]

def index
@articles = Article.all
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CommentsController < ApplicationController

http_basic_authenticate_with name: "openshift", password: "secret", only: :destroy
http_basic_authenticate_with name: ENV["APPLICATION_USER"], password: ENV["APPLICATION_PASSWORD"], only: :destroy

def create
@article = Article.find(params[:article_id])
Expand Down
22 changes: 14 additions & 8 deletions openshift/templates/rails-postgresql.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@
{
"name": "APPLICATION_DOMAIN",
"value": "${APPLICATION_DOMAIN}"
},
{
"name": "APPLICATION_USER",
"value": "${APPLICATION_USER}"
},
{
"name": "APPLICATION_PASSWORD",
"value": "${APPLICATION_PASSWORD}"
}
]
}
Expand Down Expand Up @@ -335,16 +343,14 @@
"from": "[a-z0-9]{127}"
},
{
"name": "ADMIN_USERNAME",
"description": "administrator username",
"generate": "expression",
"from": "admin[A-Z0-9]{3}"
"name": "APPLICATION_USER",
"description": "The application user that is used within the sample application to authorize access on pages",
"value": "openshift"
},
{
"name": "ADMIN_PASSWORD",
"description": "administrator password",
"generate": "expression",
"from": "[a-zA-Z0-9]{8}"
"name": "APPLICATION_PASSWORD",
"description": "The application password that is used within the sample application to authorize access on pages",
"value": "secret"
},
{
"name": "DATABASE_SERVICE_NAME",
Expand Down
18 changes: 18 additions & 0 deletions openshift/templates/rails.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@
{
"name": "APPLICATION_DOMAIN",
"value": "${APPLICATION_DOMAIN}"
},
{
"name": "APPLICATION_USER",
"value": "${APPLICATION_USER}"
},
{
"name": "APPLICATION_PASSWORD",
"value": "${APPLICATION_PASSWORD}"
}
],
"ports": [
Expand Down Expand Up @@ -205,6 +213,16 @@
"description": "Your secret key for verifying the integrity of signed cookies",
"generate": "expression",
"from": "[a-z0-9]{127}"
},
{
"name": "APPLICATION_USER",
"description": "The application user that is used within the sample application to authorize access on pages",
"value": "openshift"
},
{
"name": "APPLICATION_PASSWORD",
"description": "The application password that is used within the sample application to authorize access on pages",
"value": "secret"
}
]
}