uri2env is a tool to convert uri to env and back.
For example:
uri2env -v -p "MY_PREFIX" "http://userA:passwordA@localhost:8080/path/stuff/here?query=yes&testing=1#some_fragment"
Would output
Input: [http://userA:passwordA@localhost:8080/path/stuff/here?query=yes&testing=1#my_fragment]
Prefix: MY_PREFIX
MY_PREFIX_SCHEME=http
MY_PREFIX_HOST=localhost
MY_PREFIX_PORT=8080
MY_PREFIX_USER=userA
MY_PREFIX_PASSWORD=passwordA
MY_PREFIX_PATH=/path/stuff/here
MY_PREFIX_QUERY=yes
MY_PREFIX_TESTING=1
MY_PREFIX_FRAGMENT=my_fragment
Usage:
uri2env [OPTIONS] [COMMANDS] [URI] [flags]
Flags:
-h, --help help for uri2env
-p, --prefix string Prefix for environment variables
-v, --verbose Verbose output: include input and prefix in output
--version version for uri2env
go run main.go -v -p MY_PREFIX "http://userA:passwordA@localhost:8080/path/stuff/here?query=yes&testing=1#my_fragment"
go build -o ./dist/uri2env
cd dist
./uri2env -v -p MY_PREFIX "http://userA:passwordA@localhost:8080/path/stuff/here?query=yes&testing=1#my_fragment"
./uri2env -v -p MY_PREFIX "http://userA:passwordA@localhost:8080/path/stuff/here?query=yes&testing=1#my_fragment" > .env
uri2env.exe -v -p MY_PREFIX "http://userA:passwordA@localhost:8080/path/stuff/here?query=yes&testing=1#my_fragment" > .env