-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #623 from gerrod3/rproxy-apiroot
Configure NGINX using API_ROOT & CONTENT_PATH_PREFIX
- Loading branch information
Showing
6 changed files
with
64 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NGINX is now configured to use the values of API_ROOT and CONTENT_PATH_PREFIX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
#!/bin/bash | ||
|
||
if [ "${PULP_HTTPS,,}" = "true" ]; then | ||
cp -avr /nginx/ssl_nginx.conf /etc/nginx/nginx.conf | ||
else | ||
cp -avr /nginx/nginx.conf /etc/nginx/nginx.conf | ||
fi | ||
python3 /nginx/template_nginx.py /nginx/nginx.conf.j2 /etc/nginx/nginx.conf | ||
|
||
exec /usr/sbin/nginx |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import argparse | ||
import os | ||
import django | ||
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured | ||
|
||
from jinja2 import Template | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
description="Create Pulp's nginx conf file based on current settings.", | ||
) | ||
parser.add_argument("template_file", type=open) | ||
parser.add_argument("output_file", type=argparse.FileType("w")) | ||
args = parser.parse_args() | ||
|
||
https = os.getenv("PULP_HTTPS", "false") | ||
values = { | ||
"https": https.lower() == "true", | ||
"api_root": "/pulp/", | ||
"content_path": "/pulp/content/", | ||
"domain_enabled": False, | ||
} | ||
|
||
try: | ||
django.setup() | ||
from django.conf import settings | ||
except (AppRegistryNotReady, ImproperlyConfigured): | ||
print("Failed to find settings for nginx template, using defaults") | ||
else: | ||
values["api_root"] = settings.API_ROOT | ||
values["content_path"] = settings.CONTENT_PATH_PREFIX | ||
values["domain_enabled"] = settings.DOMAIN_ENABLED | ||
|
||
template = Template(args.template_file.read()) | ||
output = template.render(**values) | ||
args.output_file.write(output) |