3 // Print a subset of the variables from the PLC configuration store in
4 // various formats (Perl, Python, PHP, sh)
6 // Mark Huang <mlhuang@cs.princeton.edu>
7 // Copyright (C) 2006 The Trustees of Princeton University
12 // Try the new plc_config.php file first
13 include 'plc_config.php';
15 if (isset($_REQUEST['perl'])) {
16 $shebang = '#!/usr/bin/perl';
17 $format = "our $%s=%s;\n";
19 } elseif (isset($_REQUEST['python'])) {
20 $shebang = '#!/usr/bin/python';
23 } elseif (isset($_REQUEST['php'])) {
25 $format = "define('%s', %s);\n";
28 $shebang = '#!/bin/sh';
35 foreach (array('PLC_API_HOST', 'PLC_API_PATH', 'PLC_API_PORT',
36 'PLC_WWW_HOST', 'PLC_BOOT_HOST', 'PLC_PLANETFLOW_HOST',
37 'PLC_NAME', 'PLC_SLICE_PREFIX',
38 'PLC_MAIL_SUPPORT_ADDRESS',
39 'PLC_MAIL_MOM_LIST_ADDRESS',
40 'PLC_MAIL_SLICE_ADDRESS')
43 // Perl, PHP, Python, and sh all support strong single quoting
44 $value = "'" . str_replace("'", "\\'", constant($name)) . "'";
45 printf($format, $name, $value);
49 printf($format, 'PLC_API_CA_SSL_CRT', "'/usr/boot/cacert.pem'");
50 printf($format, 'PLC_ROOT_GPG_KEY_PUB', "'/usr/boot/pubring.gpg'");