Skip to content

Commit 5430f58

Browse files
committed
Clarifying the comments in the config files.
1 parent 7a59ad5 commit 5430f58

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

Diff for: nginx.conf

+22-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
## Taytay:
21
## The below contents and nginx_3scale_access.lua are created by 3Scale by
32
## following the steps here:
43
## https://support.3scale.net/howtos/api-configuration/nginx-proxy
54
##
6-
## (I've taken the generated .conf file and modified it to work on Heroku)
7-
## You'll replace the contents below with the .conf file that 3Scale gives you
8-
## Then, you'll make the same minor modifications I did. Just search for
9-
## 'HEROKU CHANGE:'
10-
## 3Scale already has some change markers called "NEED CHANGE"
11-
## You can probably ignore them for the simplest tests
5+
## A few minor modifications are necessary to get the generated config
6+
## to work on Heroku. Search for 'HEROKU CHANGE:' in this file and make the same
7+
## changes to your nginx.conf file
8+
## Note that 3Scale puts their own change markers in the generated called
9+
## "NEED CHANGE", so you will see some of those below too.
1210

1311
## NEED CHANGE (defines the user of the nginx workers)
1412
# user user group;
1513

1614
## THIS PARAMETERS BE SAFELY OVER RIDDEN BY YOUR DEFAULT NGINX CONF
1715
worker_processes 2;
1816
error_log logs/error.log warn;
19-
# HEROKU CHANGE: We don't want it running as a daemon, but as a normal process
17+
18+
## HEROKU CHANGE: Add this "daemon off" line to your file so that it runs as a
19+
## normal process rather than a daemon
2020
daemon off;
2121

2222
events {
@@ -36,20 +36,23 @@ http {
3636
}
3737

3838
server {
39-
#HEROKU CHANGE: We have to have this placeholder port in here to work on Heroku
39+
## HEROKU CHANGE: Heroku assigns a different port every time, so use this
40+
## placeholder instead of hardcoding it:
4041
listen ${{PORT}};
4142

42-
## HEROKU CHANGE: CHANGE YOUR SERVER NAME TO YOUR CUSTOM DOMAIN OR COMMENT IT OUT IF ONLY HAVE ONE
43+
## CHANGE YOUR SERVER_NAME TO YOUR CUSTOM DOMAIN OR COMMENT IT OUT IF ONLY HAVE ONE
4344
#server_name api-proxy-3scale-heroku.herokuapp.com;
4445
underscores_in_headers on;
4546

4647
location = /threescale_authrep {
4748
internal;
48-
## HEROKU CHANGE: MAKE A HEROKU ENVIRONMENT VARIABLE CALLED 3SCALE_PROVIDER_KEY
49-
## >heroku config:set 3SCALE_PROVIDER_KEY=1239832745abcde...
49+
## HEROKU CHANGE: (OPTIONAL)
5050
## 3Scale normally hardcodes the provider_key here, but if you want to avoid
51-
## checking that into source code, you can use Heroku environment variables
52-
set $provider_key "${{3SCALE_PROVIDER_KEY}}";
51+
## checking that into source code, you can create a Heroku config
52+
## environment variable called "3SCALE_PROVIDER_KEY" and uncomment the
53+
## following line.
54+
#set $provider_key "${{3SCALE_PROVIDER_KEY}}";
55+
set $provider_key "hardcoded_secret_3scale_providerkey";
5356

5457
proxy_pass http://threescale_backend/transactions/authrep.xml?provider_key=$provider_key&service_id=$service_id&$usage&$credentials;
5558
proxy_set_header Host su1.3scale.net;
@@ -59,9 +62,9 @@ http {
5962
internal;
6063
proxy_pass_request_headers off;
6164
##needs to be in both places, better not to have it on location / for potential security issues, req. are internal
62-
## HEROKU CHANGE: MAKE A HEROKU ENVIRONMENT VARIABLE CALLED 3SCALE_PROVIDER_KEY
63-
## >heroku config:set 3SCALE_PROVIDER_KEY=1239832745abcde...
64-
set $provider_key "${{3SCALE_PROVIDER_KEY}}";
65+
## HEROKU CHANGE: (OPTIONAL) (see note above)
66+
#set $provider_key "${{3SCALE_PROVIDER_KEY}}";
67+
set $provider_key "hardcoded_secret_3scale_providerkey";
6568

6669

6770
content_by_lua '
@@ -89,15 +92,14 @@ http {
8992
set $cached_key null;
9093
set $credentials null;
9194
set $usage null;
92-
## HEROKU CHANGE: This will be your own service id as told by 3Scale
9395
set $service_id 1234567890;
9496
set $proxy_pass null;
9597
set $secret_token null;
9698

9799
proxy_ignore_client_abort on;
98100

99-
## You don't need to change this unless you put the lua file in a different spot
100-
## CHANGE THE PATH TO POINT TO THE RIGHT FILE ON YOUR FILESYSTEM
101+
## HEROKU CHANGE: Make sure you rename the generated .lua file to
102+
## nginx_3scale_access.lua so that this line works:
101103
access_by_lua_file nginx_3scale_access.lua;
102104

103105
proxy_pass $proxy_pass ;

Diff for: nginx_3scale_access.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-- This file is generated for you by 3Scale by following the steps here:
22
-- https://support.3scale.net/howtos/api-configuration/nginx-proxy
3-
-- Just paste the contents of their generated .lua file in here
3+
-- Overwrite the contents of this file with their generated .lua file

0 commit comments

Comments
 (0)