Kaya 0.5.3 reference for System::getEnv

List of functions and data types in System

String getEnv(String env)

Arguments

Usage

Retrieves the value of an environment variable.

This is often necessary in a web application as the web server will set environment variables in the program. Some of these headers are set by the server environment, others are set based on the current request (and so may be trivially forged by the user's browser).

ua = getEnv("HTTP_USER_AGENT"); // Contents of User-Agent header
host = getEnv("HTTP_HOST"); // the IP address of the web server
user = getEnv("REMOTE_USER"); // the username under HTTP authentication
ip = getEnv("REMOTE_ADDR"); // the client's IP address

Environment variables are also useful for command-line programs

home = getEnv("HOME"); // The user's home directory on Posix systems
proxy = getEnv("HTTP_PROXY"); // The HTTP proxy to use for outgoing connections

If the environment variable is not set, the empty String will be returned.

Related

kaya@kayalang.org | Last modified 29 November 2011 | Supported by Durham CompSoc | Powered by Kaya