1 /** @file
2 
3   A brief file description
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #include "tscore/ink_platform.h"
25 #include "MgmtUtils.h"
26 #include "tscore/Diags.h"
27 #include "FileManager.h"
28 
29 extern FileManager *configFiles;
30 
31 /****************************************************************************
32  *
33  *  AddConfigFilesHere.cc - Structs for config files and
34  *
35  *
36  ****************************************************************************/
37 
38 void
39 testcall(char *foo, char * /*configName */)
40 {
41   Debug("lm", "Received Callback that %s has changed", foo);
42 }
43 
44 void
45 registerFile(const char *configName, const char *defaultName)
46 {
47   bool found        = false;
48   const char *fname = REC_readString(configName, &found);
49   if (!found) {
50     fname = defaultName;
51   }
52   configFiles->addFile(fname, configName, false);
53 }
54 
55 //
56 // initializeRegistry()
57 //
58 // Code to initialize of registry of objects that represent
59 //   Web Editable configuration files
60 //
61 // thread-safe: NO!  - Should only be executed once from the main
62 //                     web interface thread, before any child
63 //                     threads have been spawned
64 void
65 initializeRegistry()
66 {
67   static int run_already = 0;
68 
69   if (run_already == 0) {
70     run_already = 1;
71   } else {
72     ink_assert(!"Configuration Object Registry Initialized More than Once");
73   }
74 
75   registerFile("proxy.config.log.config.filename", "logging.yaml");
76   registerFile("", "storage.config");
77   registerFile("proxy.config.socks.socks_config_file", "socks.config");
78   registerFile("records.config", "records.config");
79   registerFile("proxy.config.cache.control.filename", "cache.config");
80   registerFile("proxy.config.cache.ip_allow.filename", "ip_allow.yaml");
81   registerFile("proxy.config.http.parent_proxy.file", "parent.config");
82   registerFile("proxy.config.url_remap.filename", "remap.config");
83   registerFile("", "volume.config");
84   registerFile("proxy.config.cache.hosting_filename", "hosting.config");
85   registerFile("", "plugin.config");
86   registerFile("proxy.config.dns.splitdns.filename", "splitdns.config");
87   registerFile("proxy.config.ssl.server.multicert.filename", "ssl_multicert.config");
88   registerFile("proxy.config.ssl.servername.filename", "sni.config");
89 
90   configFiles->registerCallback(testcall);
91 }
92