Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API authentication #330

Merged
merged 13 commits into from
Jan 23, 2025
3 changes: 2 additions & 1 deletion argo/config.py.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DJANGO_ALLOWED_HOSTS = ${DJANGO_ALLOWED_HOSTS}
ELASTICSEARCH_HOSTS = ${ELASTICSEARCH_HOSTS}
ELASTICSEARCH_INDEX = "${ELASTICSEARCH_INDEX}"
ELASTICSEARCH_CONNECTION = "${ELASTICSEARCH_CONNECTION}"
ELASTICSEARCH_API_KEY = "${ELASTICSEARCH_API_KEY}"
SQL_ENGINE = "${SQL_ENGINE}"
SQL_DATABASE = "${SQL_DATABASE}"
SQL_USER = "${SQL_USER}"
Expand All @@ -15,4 +16,4 @@ USE_X_FORWARDED_HOST = ${USE_X_FORWARDED_HOST}
SECURE_PROXY_SSL_HEADER = ${SECURE_PROXY_SSL_HEADER}
CITATION_REPOSITORY_NAME = "${CITATION_REPOSITORY_NAME}"
CITATION_REPOSITORY_BASEURL = "${CITATION_REPOSITORY_BASEURL}"
CITATION_SEPARATOR = "${CITATION_SEPARATOR}"
CITATION_SEPARATOR = "${CITATION_SEPARATOR}"
3 changes: 2 additions & 1 deletion argo/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DJANGO_ALLOWED_HOSTS = ["localhost", "argo-web"] # hosts Argo will respond to (
ELASTICSEARCH_HOSTS = ["elasticsearch:9200"] # hostnames (including ports, if applicable) at which Elasticsearch is available (list of strings)
ELASTICSEARCH_INDEX = "default" # name of Elasticsearch index to target (string)
ELASTICSEARCH_CONNECTION = "default" # name of Elasticsearch connection to use (string)
ELASTICSEARCH_API_KEY = None # String of encoded API Key provided by Elasticsearch. Use None if not authenticating
SQL_ENGINE = "django.db.backends.postgresql" # the database engine used by Argo (string, one of django.db.backends)
SQL_DATABASE = "postgres" # name of the application database (string)
SQL_USER = "postgres" # name of the application database user (string)
Expand All @@ -15,4 +16,4 @@ USE_X_FORWARDED_HOST = False # Set to True if the application is behind a revers
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") # If the application is being a reverse proxy, and if a header value indicates an HTTPS connection proxied over HTTP, name that header and value (tuple)
CITATION_REPOSITORY_NAME = "Rockefeller Archive Center" # name of repository used in citations
CITATION_REPOSITORY_BASEURL = "https://dimes.rockarch.org/" # base url for citation links
CITATION_SEPARATOR = "; " # string to separate different parts of the citation
CITATION_SEPARATOR = "; " # string to separate different parts of the citation
3 changes: 2 additions & 1 deletion argo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
"default": {
"hosts": config.ELASTICSEARCH_HOSTS,
"index": config.ELASTICSEARCH_INDEX,
"connection": config.ELASTICSEARCH_CONNECTION
"connection": config.ELASTICSEARCH_CONNECTION,
"api_key": getattr(config, 'ELASTICSEARCH_API_KEY', None)
}
}

Expand Down
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
argo-db:
image: postgres:14.4
Expand All @@ -22,7 +20,7 @@ services:
- argo-db

elasticsearch:
image: elasticsearch:7.9.3
image: elasticsearch:7.17.25
environment:
- node.name=elasticsearch
- discovery.seed_hosts=elasticsearch
Expand Down
Loading