@@ -23,7 +23,7 @@ def main():
2323 parser .add_argument ("-ghr" , "--repository" , help = 'the repository name.' )
2424 parser .add_argument ("-obf" , "--obfuscator" , help = 'the subfolder-name in gh-pages branch used as obfuscator' )
2525 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' ] )
26+ parser .add_argument ("-a" , "--authType" , help = 'how should users auth.' , choices = ['allGitHubUsers' , 'onlyGitHubOrgUsers' ], required = False )
2727
2828
2929 args = parser .parse_args ()
@@ -38,6 +38,15 @@ def main():
3838
3939 sys .exit (1 )
4040
41+ if args .environment == 'heroku' :
42+ args = parser .parse_args (['--environment' , 'heroku' ,
43+ '--port' , os .environ .get ("PORT" , 5000 ),
44+ '--authType' , os .environ .get ("PROXY_AUTH_TYPE" , 'allGitHubUsers' ),
45+ '--owner' , os .environ .get ("GITHUB_REPOSITORY_OWNER" , 'comsysto' ),
46+ '--repository' , os .environ .get ("GITHUB_REPOSITORY_NAME" , 'github-pages-basic-auth-proxy' ),
47+ '--obfuscator' , os .environ .get ("GITHUB_REPOSITORY_OBFUSCATOR" , '086e41eb6ff7a50ad33ad742dbaa2e70b75740c4950fd5bbbdc71981e6fe88e3' )
48+ ])
49+
4150 run_proxy (args )
4251
4352#
@@ -136,6 +145,10 @@ def error500(error):
136145 def hello ():
137146 return 'ok'
138147
148+ @route ('/install-success' )
149+ def hello ():
150+ return 'The Auth Basic GitHub Pages Proxy was installed successfully.'
151+
139152 #
140153 # make args available in auth callback
141154 #
@@ -159,7 +172,7 @@ def proxy_trough_root_page():
159172 if args .environment == 'wsgi' :
160173 run (host = 'localhost' , port = args .port , debug = True )
161174 if args .environment == 'heroku' :
162- run (host = "0.0.0.0" , port = int (os . environ . get ( "PORT" , 5000 ) ))
175+ run (host = "0.0.0.0" , port = int (args . port ))
163176 else :
164177 run (server = 'cgi' )
165178
0 commit comments