Skip to content

Commit

Permalink
Merge pull request sclorg#17 from ewolinetz/app_auth_vars
Browse files Browse the repository at this point in the history
Updating application to use env vars for authentication instead of st…
  • Loading branch information
bparees committed Jun 16, 2015
2 parents 0569c56 + eae3441 commit 16716f4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
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"
}
]
}

0 comments on commit 16716f4

Please sign in to comment.