Skip to content

A utility `setenv` function for Kotlin (Java 17+) to set environment variables for current process

Notifications You must be signed in to change notification settings

TelenorNorway/setenv.kt

Repository files navigation

SetEnv

A simple function for Kotlin that can be used in unit tests to set environment variables for the current instance of Java.

Note that this only works for Java 17+

Dependency

In your gradle file

Follow this guide on how to set up your environment for GitHub packages.

plugins {
	id("no.ghpkg") version "0.3.3"
}

repositories {
	git.hub("telenornorway", "setenv.kt")
	// or <.. the below> if you're spicy 🌶️
	// git.hub("telenornorway")
}

dependencies {
	testImplementation("no.telenor.kt:setenv:<VERSION HERE>")
}

Usage

import no.telenor.kt.env.Environment

Environment.set("my variable", "my value")

Environment.set(
	"my variable 1" to "my value 1",
	"my variable 2" to "my value 2",
)

About

A utility `setenv` function for Kotlin (Java 17+) to set environment variables for current process

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages