Skip to content

Commit 001890c

Browse files
committed
Fix auth integration test, also helps with deployment (#24)
1 parent eeaed05 commit 001890c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scrapyd_k8s/api.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,13 @@ def error(msg, status=200):
133133
return { 'status': 'error', 'message': msg }, status
134134

135135
def enable_authentication(app, config_username, config_password):
136-
basic_auth = BasicAuth(app)
136+
137+
# workaround for https://github.com/jpvanhal/flask-basicauth/issues/11
138+
class BasicAuthExceptHealthz(BasicAuth):
139+
def authenticate(self):
140+
return request.path == "/healthz" or super().authenticate()
141+
142+
basic_auth = BasicAuthExceptHealthz(app)
137143
app.config["BASIC_AUTH_USERNAME"] = config_username
138144
app.config["BASIC_AUTH_PASSWORD"] = config_password
139145
app.config["BASIC_AUTH_FORCE"] = True

0 commit comments

Comments
 (0)