Skip to content
This repository was archived by the owner on Sep 22, 2020. It is now read-only.

Commit ecb886f

Browse files
merge files because heriku ha problems with relative imports
1 parent 64c35e9 commit ecb886f

5 files changed

Lines changed: 38 additions & 37 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ peewee.db
2424
*.pyc
2525
/dist/
2626
/*.egg-info
27-
build/
27+
build/
28+
29+
# heroku
30+
venv/

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: cs-gh-proxy -e wsgi -p 8881 --authType allGitHubUsers --owner comsysto --repository github-pages-basic-auth-proxy --obfuscator 086e41eb6ff7a50ad33ad742dbaa2e70b75740c4950fd5bbbdc71981e6fe88e3
1+
web: python cs_proxy/proxy.py -e heroku -p $PORT --authType allGitHubUsers --owner comsysto --repository github-pages-basic-auth-proxy --obfuscator 086e41eb6ff7a50ad33ad742dbaa2e70b75740c4950fd5bbbdc71981e6fe88e3

cs_proxy/proxy.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import sys, os
2+
import argparse
3+
import colorama
24
from bottle import route, request, response, run, hook, abort, redirect, error, install, auth_basic
35
import simplejson as json
46
import random
@@ -10,6 +12,34 @@
1012
from jose.exceptions import JWSError
1113
import datetime
1214

15+
def main():
16+
#
17+
# CLI PARAMS
18+
#
19+
parser = argparse.ArgumentParser(description='comSysto GitHub Pages Auth Basic Proxy')
20+
21+
parser.add_argument("-e", "--environment", help='Which environment.', choices=['cgi', 'wsgi', 'heroku'])
22+
parser.add_argument("-gho", "--owner", help='the owner of the repository. Either organizationname or username.')
23+
parser.add_argument("-ghr", "--repository", help='the repository name.')
24+
parser.add_argument("-obf", "--obfuscator", help='the subfolder-name in gh-pages branch used as obfuscator')
25+
parser.add_argument("-p", "--port", help='the port to run proxy e.g. 8881')
26+
parser.add_argument("-a", "--authType", help='how should users auth.', choices=['allGitHubUsers', 'onlyGitHubOrgUsers'] )
27+
28+
29+
args = parser.parse_args()
30+
if not args.environment:
31+
print ('USAGE')
32+
print (' proxy that allows only members of the organization to access page: (owner must be an GitHub Organization)')
33+
print (' $> cs-gh-proxy -e wsgi -p 8881 --authType onlyGitHubOrgUsers --owner comsysto --repository github-pages-basic-auth-proxy --obfuscator 086e41eb6ff7a50ad33ad742dbaa2e70b75740c4950fd5bbbdc71981e6fe88e3')
34+
print ('')
35+
print (' proxy that allows all GitHub Users to access page: (owner can be GitHub Organization or normal user)')
36+
print (' $> cs-gh-proxy -e wsgi -p 8881 --authType allGitHubUsers --owner comsysto --repository github-pages-basic-auth-proxy --obfuscator 086e41eb6ff7a50ad33ad742dbaa2e70b75740c4950fd5bbbdc71981e6fe88e3')
37+
print ('')
38+
39+
sys.exit(1)
40+
41+
run_proxy(args)
42+
1343
#
1444
# global vars
1545
#
@@ -128,6 +158,8 @@ def proxy_trough_root_page():
128158
#
129159
if args.environment == 'wsgi':
130160
run(host='localhost', port=args.port, debug=True)
161+
if args.environment == 'heroku':
162+
run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)))
131163
else:
132164
run(server='cgi')
133165

cs_proxy/run_proxy.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
],
2222
zip_safe=False,
2323
entry_points = {
24-
'console_scripts': ['cs-gh-proxy=cs_proxy.run_proxy:main'],
24+
'console_scripts': ['cs-gh-proxy=cs_proxy.proxy:main'],
2525
})

0 commit comments

Comments
 (0)