How to use an environment variable in Sapper's template.html? - environment-variables

I would like to use an environment variable within template.html so that I can change the content in the head for all pages based on where I'm running the app. Is this possible?

I never found a way to put environment variables in template.html, but I passed what I needed through server.js, picked it up in _layout.svelte, and included it in a <svelte:head> element.

Related

Where does Postman store current value of environment variables?

I've been looking around my machine to see where the postman environment variables are stored. I've looked under AppData\Local\Postman, and C:\Users\username\Postman folders, and haven't found a config file that has a last modified date matching my change of environment variables.
I know I can export the environment variables, but I want to search over the current variables. And the exports don't include the current values, unless they replace the initial value, which I want to keep.
There are still ways to get around this. But I want to write a simple command to fetch some current environment variables via cmd, ex using grep.
So is there a way to check for the current environment variables? Where are they stored?
I don't think this will be a successful attempt. Postman seems to use a database, e.g. leveldb, according to information I found here. That will be stored as a binary file on your disk.
You can, however, have a look into the DB by going to View => Developer => Show DevTools and then going to Storage => IndexedDB => variable_sessions => workspace. I can find a current value for an environment variable like this:
But I don't see a way to search in this other than by keys which are uuids and not variable names or values.
All in all, exporting your environments into a text file might be the easiest option.

date variable in TFS

I am trying to create a variable in TFS for my task for timestamp in format yyyymmdd. I know that I create a task specifically for this using bash or powershell. However, I am looking to find some existing variable or some way to create this variable without having to setup a task dedicated for itself.
So far I have tried to use $(Date:yyyymmdd) in my variables but it does not put values in it, it uses variable name as is.
For example, C:\Alpha\beta\$(Date:yyyymmdd) instead of C:\Alpha\beta\20191107
Can anyone help me with this ? Thanks a lot
Actually, it is hence not expanded. We do not have this kind of system or environment variable which get current date time and work every. You may have noticed you could use $(Date), however which is only available in the Build number format section. Others such as $(Rev:r) and $(DateOfYear) are the same, do not work outside the BuildNumberFormat-Settings..
Take a look at the list of all system and environment variables here: Predefined variables
As you have pointed out, you need to use a script in a PowerShell Task to set a variable in your build definition, a sample:
$date=$(Get-Date -Format 'yyyymmdd');
Write-Host "##vso[task.setvariable variable=time]$date"
Then you can use $(time) in your subsequent build tasks.
More details also take a look at this similar question: VSO(TFS) - get current date time as variable

Get all environment variables in Dlang

https://dlang.org/library/std/process/environment.html allows getting a particular environment variable.
But I see no way to get all environment variables or the list of all environment variable names.
What is the right way to retrieve the full environment in D?
In fact, I want to pass some environment variables to a child process. What is the right way to do it?
There is no need to get all variables to pass to a child process; that is the default. If you are using the std.process library, you can pass null for environment to keep the existing one entirely, or a set of just the keys and values you want to change to get just them changed, and the rest inherited.

Storing URL's in Environment variables in Ruby

I'm trying to store URL's in my environment variables. So for instance
ENV['SET_COOKIE_URL'] = 'http://domain.com/setcookie'
In my application layout page, I'm trying to do this:
window.top.location = '<%= ENV["SET_COOKIE_URL"] %>';
When I try this, it always returns '' (empty string).
Can you not store and output URL's in environment variables?
If you just added this environment variable, perhaps re-starting your server would help pickup the environment change. I don't see any reason why you won't be able to use that environment variable in your view other than just re-booting your server.

How can I define values from outside my script?

I'd like to pass some variables into my .nsi script. Either from the environment or the command line, how do I do this?
I found a section in the documentation that suggests I can use the syntax $%envVarName% to use environment variables in my script, but this doesn't seem to work, when I have
File "/oname=$pluginsdir\inst.msi" "$%VERSION%-Installer-64bit.msi"
I get the error
File: "$%VERSION%-Installer-64bit.msi" -> no files found.
$VERSION is in my environment.
Is there something I'm doing wrong with trying to read environment variables, or some other way of passing values into my script?
$%VERSION% should work if you used set VERSION=1.2.3.4
Or you can create defines: makensis -DVERSION=1.2.3.4 myscript.nsi and File: "${VERSION}-Installer-64bit.msi"

Resources