import ballerina/io;
import ballerina/os;
public function main() {
// Returns the environment variable value associated with the `HTTP_PORT`.
string port = os:getEnv("HTTP_PORT");
io:println("HTTP_PORT: ", port);
// Returns the username of the current user.
string username = os:getUsername();
io:println("Username: ", username);
// Returns the current user's home directory path.
string userHome = os:getUserHome();
io:println("Userhome: ", userHome);
}
Environment variablesThe |
import ballerina/io;
import ballerina/os;
public function main() {
string port = os:getEnv("HTTP_PORT");
io:println("HTTP_PORT: ", port);
Returns the environment variable value associated with the HTTP_PORT
.
string username = os:getUsername();
io:println("Username: ", username);
Returns the username of the current user.
string userHome = os:getUserHome();
io:println("Userhome: ", userHome);
}
Returns the current user’s home directory path.
bal run environment_variables.bal
HTTP_PORT: 5005
Username: Alex
Userhome: /Users/Alex