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

Commit e1bb26e

Browse files
basic working setup and wsgi server with bottle
1 parent 5790879 commit e1bb26e

5 files changed

Lines changed: 59 additions & 9 deletions

File tree

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ server {
6868
The python proxy runs as WSGI standalone process on port 8881.
6969

7070
```
71-
python run_proxy_prod.py &
71+
git clone https://github.com/comsysto/github-pages-basic-auth-proxy.git
72+
cd github-pages-basic-auth-proxy
73+
sudo python3 setup.py install
7274
```
73-
75+
run
76+
```
77+
cs-gh-proxy -e wsgi -u csgruenebe -gh https://comsysto.github.io/github-pages-basic-auth-proxy/086e41eb6ff7a50ad33ad742dbaa2e70b75740c4950fd5bbbdc71981e6fe88e3/
78+
```

proxy.py renamed to cs_proxy/proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def hello():
4141
#
4242
# RUN BY ENVIRONMENT
4343
#
44-
if env == 'dev' or env == 'local':
44+
if env == 'wsgi':
4545
run(host='localhost', port=8881, debug=True)
4646
else:
4747
run(server='cgi')

cs_proxy/run_proxy.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from .proxy import run_proxy
2+
3+
import argparse
4+
import sys
5+
import colorama
6+
import requests
7+
8+
def main():
9+
#
10+
# CLI PARAMS
11+
#
12+
parser = argparse.ArgumentParser(description='comSysto GitHub Pages Auth Basic Proxy')
13+
14+
parser.add_argument("-e", "--environment", help='Which environment.', choices=['cgi', 'wsgi'])
15+
parser.add_argument("-gh", "--githubPagesUrl", help='baseUrl to gh-pages page e.g. https://foo.github.io/repo/2323/')
16+
parser.add_argument("-u", "--allowedUsers", help='allowed usernames.')
17+
18+
args = parser.parse_args()
19+
if not args.environment:
20+
print ('USAGE')
21+
print (' proxy:')
22+
print (' $> cs-gh-proxy -e wsgi -u csgruenebe -gh https://comsysto.github.io/github-pages-basic-auth-proxy/086e41eb6ff7a50ad33ad742dbaa2e70b75740c4950fd5bbbdc71981e6fe88e3/ ')
23+
print ('')
24+
25+
sys.exit(1)
26+
27+
run_proxy(args.environment)

run_proxy_prod.py

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

setup.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from setuptools import setup
2+
3+
setup(name='comsysto_github_pages_basic_auth_proxy',
4+
version='0.0.1',
5+
description='Python Proxy for GitHub Pages with Basic Auth',
6+
url='https://github.com/comsysto/github-pages-basic-auth-proxy',
7+
author='comSysto GmbH',
8+
author_email='info@comsysto.com',
9+
license='MIT',
10+
packages=[
11+
'cs_proxy'
12+
],
13+
install_requires=[
14+
'requests',
15+
'argparse',
16+
'validators',
17+
'colorama',
18+
'bottle',
19+
'simplejson'
20+
],
21+
zip_safe=False,
22+
entry_points = {
23+
'console_scripts': ['cs-gh-proxy=cs_proxy.run_proxy:main'],
24+
})

0 commit comments

Comments
 (0)