unify compressable mime types across modules
also improve template expansion
This commit is contained in:
parent
a747fbe080
commit
9ca1528f41
@ -1,24 +0,0 @@
|
|||||||
## default is 6
|
|
||||||
brotli_comp_level 5;
|
|
||||||
## default is 512k
|
|
||||||
brotli_window 64k;
|
|
||||||
|
|
||||||
brotli_min_length 1024;
|
|
||||||
brotli_buffers 32 16k;
|
|
||||||
|
|
||||||
brotli_types
|
|
||||||
application/atom+xml
|
|
||||||
application/javascript
|
|
||||||
application/json
|
|
||||||
application/vnd.api+json
|
|
||||||
application/rss+xml
|
|
||||||
application/x-javascript
|
|
||||||
application/xhtml+xml
|
|
||||||
application/xml
|
|
||||||
image/svg+xml
|
|
||||||
image/x-icon
|
|
||||||
text/css
|
|
||||||
text/javascript
|
|
||||||
text/plain
|
|
||||||
text/xml
|
|
||||||
;
|
|
14
angie/snip.dist/http-brotli.conf.j2
Normal file
14
angie/snip.dist/http-brotli.conf.j2
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{%- from 'mime-types.compress.j2inc' import mime_types with context -%}
|
||||||
|
|
||||||
|
## default is 6
|
||||||
|
brotli_comp_level 5;
|
||||||
|
## default is 512k
|
||||||
|
brotli_window 64k;
|
||||||
|
|
||||||
|
brotli_min_length 1024;
|
||||||
|
brotli_buffers 32 16k;
|
||||||
|
|
||||||
|
brotli_types
|
||||||
|
## sourced from mime-types.compress.txt
|
||||||
|
{{ mime_types | indent(4) }}
|
||||||
|
;
|
@ -1,25 +0,0 @@
|
|||||||
## default is 1
|
|
||||||
gzip_comp_level 2;
|
|
||||||
|
|
||||||
gzip_min_length 1024;
|
|
||||||
gzip_buffers 32 16k;
|
|
||||||
|
|
||||||
gzip_vary on;
|
|
||||||
gzip_proxied any;
|
|
||||||
|
|
||||||
gzip_types
|
|
||||||
application/atom+xml
|
|
||||||
application/javascript
|
|
||||||
application/json
|
|
||||||
application/vnd.api+json
|
|
||||||
application/rss+xml
|
|
||||||
application/x-javascript
|
|
||||||
application/xhtml+xml
|
|
||||||
application/xml
|
|
||||||
image/svg+xml
|
|
||||||
image/x-icon
|
|
||||||
text/css
|
|
||||||
text/javascript
|
|
||||||
text/plain
|
|
||||||
text/xml
|
|
||||||
;
|
|
15
angie/snip.dist/http-gzip.conf.j2
Normal file
15
angie/snip.dist/http-gzip.conf.j2
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{%- from 'mime-types.compress.j2inc' import mime_types with context -%}
|
||||||
|
|
||||||
|
## default is 1
|
||||||
|
gzip_comp_level 2;
|
||||||
|
|
||||||
|
gzip_min_length 1024;
|
||||||
|
gzip_buffers 32 16k;
|
||||||
|
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_proxied any;
|
||||||
|
|
||||||
|
gzip_types
|
||||||
|
## sourced from mime-types.compress.txt
|
||||||
|
{{ mime_types | indent(4) }}
|
||||||
|
;
|
@ -1,22 +0,0 @@
|
|||||||
## default is 1
|
|
||||||
zstd_comp_level 2;
|
|
||||||
|
|
||||||
zstd_min_length 1024;
|
|
||||||
zstd_buffers 32 16k;
|
|
||||||
|
|
||||||
zstd_types
|
|
||||||
application/atom+xml
|
|
||||||
application/javascript
|
|
||||||
application/json
|
|
||||||
application/vnd.api+json
|
|
||||||
application/rss+xml
|
|
||||||
application/x-javascript
|
|
||||||
application/xhtml+xml
|
|
||||||
application/xml
|
|
||||||
image/svg+xml
|
|
||||||
image/x-icon
|
|
||||||
text/css
|
|
||||||
text/javascript
|
|
||||||
text/plain
|
|
||||||
text/xml
|
|
||||||
;
|
|
12
angie/snip.dist/http-zstd.conf.j2
Normal file
12
angie/snip.dist/http-zstd.conf.j2
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{%- from 'mime-types.compress.j2inc' import mime_types with context -%}
|
||||||
|
|
||||||
|
## default is 1
|
||||||
|
zstd_comp_level 2;
|
||||||
|
|
||||||
|
zstd_min_length 1024;
|
||||||
|
zstd_buffers 32 16k;
|
||||||
|
|
||||||
|
zstd_types
|
||||||
|
## sourced from mime-types.compress.txt
|
||||||
|
{{ mime_types | indent(4) }}
|
||||||
|
;
|
2
angie/snip.dist/mime-types.compress.j2inc
Normal file
2
angie/snip.dist/mime-types.compress.j2inc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{%- set mime_file = pathlib.Path(os.path.join(os.getenv('NGX_MERGED_ROOT'), 'snip/mime-types.compress.txt')) -%}
|
||||||
|
{%- set mime_types = mime_file.read_text() -%}
|
14
angie/snip.dist/mime-types.compress.txt
Normal file
14
angie/snip.dist/mime-types.compress.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
application/atom+xml
|
||||||
|
application/javascript
|
||||||
|
application/json
|
||||||
|
application/vnd.api+json
|
||||||
|
application/rss+xml
|
||||||
|
application/x-javascript
|
||||||
|
application/xhtml+xml
|
||||||
|
application/xml
|
||||||
|
image/svg+xml
|
||||||
|
image/x-icon
|
||||||
|
text/css
|
||||||
|
text/javascript
|
||||||
|
text/plain
|
||||||
|
text/xml
|
@ -5,6 +5,8 @@ set -f
|
|||||||
|
|
||||||
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
|
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
|
||||||
|
|
||||||
|
export NGX_MERGED_ROOT="${merged_root}"
|
||||||
|
|
||||||
expand_error() {
|
expand_error() {
|
||||||
[ "${expand_error_seen:-}" = 1 ] || log_always 'template expansion has failed'
|
[ "${expand_error_seen:-}" = 1 ] || log_always 'template expansion has failed'
|
||||||
expand_error_seen=1
|
expand_error_seen=1
|
||||||
@ -19,12 +21,15 @@ expand_error() {
|
|||||||
dirs='conf mod modules njs site snip'
|
dirs='conf mod modules njs site snip'
|
||||||
[ "${NGX_PROCESS_STATIC}" = 0 ] || dirs="${dirs} static"
|
[ "${NGX_PROCESS_STATIC}" = 0 ] || dirs="${dirs} static"
|
||||||
|
|
||||||
|
merge_dirs=
|
||||||
for n in ${dirs} ; do
|
for n in ${dirs} ; do
|
||||||
merged_dir="${merged_root}/$n"
|
merged_dir="${merged_root}/$n"
|
||||||
[ -d "${merged_dir}" ] || continue
|
[ -d "${merged_dir}" ] || continue
|
||||||
|
|
||||||
expand_dir_envsubst "${merged_dir}/" || expand_error
|
merge_dirs="${merge_dirs} ${merged_dir}/"
|
||||||
expand_dir_jinja "${merged_dir}/" || expand_error
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
expand_dir_envsubst ${merge_dirs} || expand_error
|
||||||
|
expand_dir_jinja ${merge_dirs} || expand_error
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -9,7 +9,7 @@ import jinja2
|
|||||||
|
|
||||||
ME = sys.argv[0]
|
ME = sys.argv[0]
|
||||||
|
|
||||||
J2_MODULES_DEFAULT = 'os os.path sys netaddr psutil re wcmatch'
|
J2_MODULES_DEFAULT = 'os os.path sys netaddr pathlib psutil re wcmatch'
|
||||||
J2_SUFFIX = '.j2'
|
J2_SUFFIX = '.j2'
|
||||||
J2_CFG_PATHS = [
|
J2_CFG_PATHS = [
|
||||||
'/angie/j2cfg',
|
'/angie/j2cfg',
|
||||||
|
Loading…
Reference in New Issue
Block a user