
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
lektor-envvars ##############
.. image:: https://circleci.com/gh/elbaschid/lektor-envvars.svg?style=svg :target: https://circleci.com/gh/elbaschid/lektor-envvars
TL;DR You can use environment variables in your Lektor templates.
I've been working with Lektor <https://www.getlektor.com/docs/plugins/>
_ as as
static site generator in quite a few projects and really enjoy it. Most recently
I work on a project that used an environment variable to create slightly
different version of the site for development
, staging
and production
.
Lektor doesn't have a way to add environment variables into the templates, so I started building my own little plugin.
You can easily install this plugin following the Lektor docs <https://www.getlektor.com/docs/plugins/>
_. All you need to do is run::
$ lektor plugin add lektor-envvars
This will automatically install the plugin and add it to your project configuration.
You are able to access environment variables using the envvars
function
inside your Jinja2 template. This function is added whenever lektor is running
a new build.
All environment variables are prefixed with LEKTOR_
by default. Let's look
at a simple example with an environment varialbe LEKTOR_DEBUG=true
::
$ export LEKTOR_DEBUG=true
You can access this variable inside any Jinja2 template::
{{ envvars('DEBUG') }}
which will display true
instead.
That's a great start but what if you want this to be a boolean value instead of
the string true
? You simply convert the value::
{{ envvars('DEBUG', bool) }}
or you can now even do::
{% if envvars('DEBUG', bool) %}
...
{% endif %}
If you don't like the LEKTOR_
prefix, you can either use your own prefix by
setting the prefix in the configs/lektor-envvars.ini
file::
[envvars]
prefix = MY_OWN_
You can now use MY_OWN_DEBUG
instead of LEKTOR_DEBUG
. This means that
all environment variables need to be prefixed with MY_OWN_
now instead.
You can also ignore the prefix all together::
{{ envvars('DEBUG', no_prefix=True) }}
which will give you access to the environment variable DEBUG
.
This code is licensed under the MIT License
_.
.. _MIT License
: https://github.com/elbaschid/lektor-envvars/blob/master/LICENSE
FAQs
A Lektor plugin making environment variables available in templates.
We found that lektor-envvars demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.