https://github.com/lestrrat-go/envload
Restore and load environment variables
https://github.com/lestrrat-go/envload
Last synced: about 2 months ago
JSON representation
Restore and load environment variables
- Host: GitHub
- URL: https://github.com/lestrrat-go/envload
- Owner: lestrrat-go
- License: mit
- Created: 2016-12-27T09:32:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-20T23:40:24.000Z (over 7 years ago)
- Last Synced: 2024-06-19T05:57:18.240Z (about 1 year ago)
- Language: Go
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# envload
Restore environment variables, so you can break 'em
[](https://travis-ci.org/lestrrat-go/envload)
[](https://godoc.org/github.com/lestrrat-go/envload)
# SYNOPSIS
# DESCRIPTION
Certain applications that require reloading of configuraiton from
environment variables are sensitive to these values being changed.Or maybe you are writing a test that wants to temporarily change the
value of an environment variable, but you don't want it to linger afterwards.In other languages this can be done with a "temporary" variable, like in
Perl5:```perl
use strict;
use 5.24;sub foo {
$ENV{IMPORTANT_VAR} = "foo";
say $ENV{IMPORTANT_VAR}; # "foo"{
local %ENV = %ENV; # inherit the original %ENV,
$ENV{IMPORTANT_VAR} = "bar";
say $ENV{IMPORTANT_VAR}; # "bar"
}
#say $ENV{IMPORTANT_VAR}; # "bar"
}
```This library basically allows you to do this in Go