1System.getEnv(3kaya) Kaya module reference System.getEnv(3kaya)
2
3
4
6 System::getEnv - Get the value of an environment variable.
7
9 String getEnv( String env )
10
12 env The name of the environment variable
13
15 Retrieves the value of an environment variable.
16
17 This is often necessary in a web application as the web server will set
18 environment variables in the program. Some of these headers are set by
19 the server environment, others are set based on the current request
20 (and so may be trivially forged by the user's browser).
21
22
23 ua = getEnv("HTTP_USER_AGENT"); // Contents of User-Agent header
24 host = getEnv("HTTP_HOST"); // the IP address of the web server
25 user = getEnv("REMOTE_USER"); // the username under HTTP authentication
26 ip = getEnv("REMOTE_ADDR"); // the client's IP address
27
28 Environment variables are also useful for command-line programs
29
30
31 home = getEnv("HOME"); // The user's home directory on Posix systems
32 proxy = getEnv("HTTP_PROXY"); // The HTTP proxy to use for outgoing con‐
33 nections
34
35 If the environment variable is not set, the empty String will be
36 returned.
37
39 Kaya standard library by Edwin Brady, Chris Morris and others
40 (kaya@kayalang.org). For further information see http://kayalang.org/
41
43 The Kaya standard library is free software; you can redistribute it
44 and/or modify it under the terms of the GNU Lesser General Public
45 License (version 2.1 or any later version) as published by the Free
46 Software Foundation.
47
49 System.getArgs (3kaya)
50 System.getPID (3kaya)
51
52
53
54Kaya December 2010 System.getEnv(3kaya)