I am super excited about this new release! On October 19th 2021 NGINX launched the latest version of NGINX njs 0.7.0.
This represents a significant step forward for njs and introduces highly anticipated features and functionality including support for the ECMAScript6 (ES6) feature async/await and the implementation of the webcrypto API. In this post, we’ll explore these aspects in more detail, starting with async/await and Promises. Once these concepts are understood, we’ll then dig into the webcrypto functionality.
Let’s get started!
| # any images you use later, add them here first to create aliases | |
| # I like keeping all my versions at the top | |
| FROM node:14.3-slim as node | |
| FROM php:7.2.1-fpm-slim as php | |
| FROM nginx:1.17 as nginx | |
| # The real base image to start from | |
| FROM ubuntu:focal-20210827 as base | |
| # install apt stuff |
| Rsync proxy for nginx |
| # We run build hooks before your application has been packaged. | |
| build: | | |
| set -e | |
| echo "\n================================== Install and configure Baler - Start ==================================" | |
| echo "================= Install and configure Baler - Upgrade node version 14.4.0 - Start =================" | |
| unset NPM_CONFIG_PREFIX | |
| curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | dash | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" |
There are many ways to parse in variable into the nginx config file.
Some uses set_by_lua which is offered by lua-nginx-module.
Some use envstubst to populate varilabes into a template file.
Today I am going to show you how to do that with njs the JS scripting engine for nginx.
## /etc/nginx/fetch_env.js
function fetch_upstream_host(r) {
return process.env.UPSTREAM_HOST;If you look on Packagist, [the most popular packages][1] for [Feature toggles][2] are:
qandidate/toggle"Feature toggling for your PHP application." (⬇️ 496.754 / ⭐ 362)opensoft/rollout"Feature switches or flags for PHP" (⬇️ 354.269 / ⭐ 215)flagception/flagception"Feature toggle on steroids." (⬇️ 139 265 / ⭐ 24)joshuaestes/feature-toggle"Provides feature toggle functionality" (⬇️ 61.736 / ⭐ 32)zumba/swivel"Strategy driven feature toggles" (⬇️ 49.954 / ⭐ 211)
These set of scripts are for Magento 2. For Magento 1, see this Gist.
| window.addEventListener('load', function(event) { | |
| var targetClassName = 'flex-wrap-anim'; | |
| var defaultDuration = '0.3s'; | |
| var dummyList = []; | |
| function addDummy(item, duration) { | |
| var top = item.offsetTop; | |
| var left = item.offsetLeft; | |
| setTimeout(function() { | |
| item.style.position = 'absolute'; |
| <?php | |
| declare(strict_types=1); | |
| namespace ApiPlatform\Workflow\PathResolver; | |
| use ApiPlatform\Core\PathResolver\OperationPathResolverInterface; | |
| final class OperationPathResolver implements OperationPathResolverInterface | |
| { |