Commit 430b1b86 authored by Jérome Perrin's avatar Jérome Perrin

software/nginx-push-stream: simplify templating

These variables were never modified, so it's easier to just "hardcode" them
where they are used.
parent d43d6792
......@@ -4,8 +4,8 @@ md5sum = eb4c69df9a8dbb94fb76d0a6c11e360f
[template-nginx-configuration]
filename = template-nginx.cfg.in
md5sum = 6f3ab2e441ff435182930b4b1140afd7
md5sum = 022e4b53e1b2db16c4e518fe76f638fa
[template-nginx]
filename = instance-nginx.cfg.in
md5sum = ac425cdab9c374985c84ea4928c0ce1b
md5sum = a3e1e8638c6078b0d3f60c304c2d70f7
......@@ -43,17 +43,6 @@ error-log = $${directory:log}/nginx-error.log
ip = $${slap-network-information:global-ipv6}
local-ip = $${slap-network-information:local-ipv4}
port = 9443
publisher-location-prefix = /pub
publisher-push-stream-store-messages = off
publisher-client-max-body-size = 16k
publisher-client-body-buffer-size = 16k
subscriber-allow-origin = '*'
subscriber-location-prefix = /sub
# Prevent to use credential if origin is star
subscriber-allow-credential = 'false'
subscriber-allow-methods = 'GET, HEAD, OPTIONS'
subscriber-allow-headers = 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since'
base-url = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}
# Generate a self-signed TLS certificate.
......@@ -86,5 +75,5 @@ config-url = $${nginx-configuration:base-url}/status
[publish-connection-information]
recipe = slapos.cookbook:publish
publisher-url = $${nginx-configuration:base-url}$${nginx-configuration:publisher-location-prefix}
subscriber-url = $${nginx-configuration:base-url}$${nginx-configuration:subscriber-location-prefix}
publisher-url = $${nginx-configuration:base-url}/pub
subscriber-url = $${nginx-configuration:base-url}/sub
......@@ -87,27 +87,25 @@ server {
return 200 'OK';
}
location $${nginx-configuration:publisher-location-prefix} {
location /pub {
push_stream_publisher;
push_stream_channels_path $arg_id;
# store messages in memory
push_stream_store_messages $${nginx-configuration:publisher-push-stream-store-messages};
push_stream_store_messages off;
# Message size limit
# client_max_body_size MUST be equal to client_body_buffer_size or
# you will be sorry.
client_max_body_size $${nginx-configuration:publisher-client-max-body-size};
client_body_buffer_size $${nginx-configuration:publisher-client-body-buffer-size};
client_max_body_size 16k;
client_body_buffer_size 16k;
}
location ~ $${nginx-configuration:subscriber-location-prefix}/(.*) {
location ~ /sub/(.*) {
# activate subscriber mode for this location
add_header "Access-Control-Allow-Origin" $${nginx-configuration:subscriber-allow-origin};
add_header 'Access-Control-Allow-Credentials' $${nginx-configuration:subscriber-allow-credential};
add_header 'Access-Control-Allow-Methods' $${nginx-configuration:subscriber-allow-methods};
add_header 'Access-Control-Allow-Headers' $${nginx-configuration:subscriber-allow-headers};
add_header "Access-Control-Allow-Origin" '*';
add_header 'Access-Control-Allow-Credentials' 'false';
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';
push_stream_subscriber eventsource;
# positional channel path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment