diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst index 099782b62fc..be0fb023817 100644 --- a/doc/admin-guide/files/records.config.en.rst +++ b/doc/admin-guide/files/records.config.en.rst @@ -2910,6 +2910,7 @@ Logging Configuration .. ts:cv:: CONFIG proxy.config.log.config.filename STRING logging.yaml :reloadable: + :deprecated: This configuration value specifies the path to the :file:`logging.yaml` configuration file. If this is a relative @@ -3061,6 +3062,7 @@ URL Remap Rules =============== .. ts:cv:: CONFIG proxy.config.url_remap.filename STRING remap.config + :deprecated: Sets the name of the :file:`remap.config` file. @@ -3191,6 +3193,7 @@ SSL Termination .. ts:cv:: CONFIG proxy.config.ssl.server.multicert.filename STRING ssl_multicert.config + :deprecated: The location of the :file:`ssl_multicert.config` file, relative to the |TS| configuration directory. In the following @@ -3259,6 +3262,7 @@ SSL Termination file is changed with new tickets, use :option:`traffic_ctl config reload` to begin using them. .. ts:cv:: CONFIG proxy.config.ssl.servername.filename STRING sni.yaml + :deprecated: The filename of the :file:`sni.yaml` configuration file. If relative, it is relative to the configuration directory. @@ -3987,6 +3991,7 @@ SOCKS Processor Specifies the SOCKS version (``4``) or (``5``) .. ts:cv:: CONFIG proxy.config.socks.socks_config_file STRING socks.config + :deprecated: The socks.config file allows you to specify ranges of IP addresses that will not be relayed to the SOCKS server. It can also be used diff --git a/include/tscore/Filenames.h b/include/tscore/Filenames.h index 6c880e02d52..6fe0eb8f460 100644 --- a/include/tscore/Filenames.h +++ b/include/tscore/Filenames.h @@ -21,11 +21,30 @@ #pragma once -/////////////////////////////////////////////////////////////////// -// Configuration file names -extern const char *STORAGE_CONF_FILENAME; -extern const char *RECORDS_CONF_FILENAME; - -/////////////////////////////////////////////////////////////////// -// Various other file names -extern const char *RECORDS_STATS_FILE; +namespace ts +{ +namespace filename +{ + constexpr const char *STORAGE = "storage.config"; + constexpr const char *RECORDS = "records.config"; + constexpr const char *VOLUME = "volume.config"; + constexpr const char *PLUGIN = "plugin.config"; + + // These still need to have their corrensponding records.config settings remove + constexpr const char *LOGGING = "logging.yaml"; + constexpr const char *CACHE = "cache.config"; + constexpr const char *IP_ALLOW = "ip_allow.yaml"; + constexpr const char *HOSTING = "hosting.config"; + constexpr const char *SOCKS = "socks.config"; + constexpr const char *PARENT = "parent.config"; + constexpr const char *REMAP = "remap.config"; + constexpr const char *SSL_MULTICERT = "ssl_multicert.config"; + constexpr const char *SPLITDNS = "splitdns.config"; + constexpr const char *SNI = "sni.yaml"; + + /////////////////////////////////////////////////////////////////// + // Various other file names + constexpr const char *RECORDS_STATS = "records.snap"; + +} // namespace filename +} // namespace ts diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 8b52c6a5a8a..b150660b0db 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -3248,7 +3248,7 @@ ink_cache_init(ts::ModuleVersion v) Result result = theCacheStore.read_config(); if (result.failed()) { - Fatal("Failed to read cache configuration %s: %s", STORAGE_CONF_FILENAME, result.message()); + Fatal("Failed to read cache configuration %s: %s", ts::filename::STORAGE, result.message()); } } diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc index 98e75073611..24930c73ef2 100644 --- a/iocore/cache/CacheHosting.cc +++ b/iocore/cache/CacheHosting.cc @@ -26,6 +26,7 @@ #include "tscore/HostLookup.h" #include "tscore/Tokenizer.h" #include "tscore/Regression.h" +#include "tscore/Filenames.h" extern int gndisks; @@ -244,7 +245,7 @@ int fstat_wrapper(int fd, struct stat *s); int CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_buf) { - Note("hosting.config loading ..."); + Note("%s loading ...", ts::filename::HOSTING); // Table build locals Tokenizer bufTok("\n"); @@ -325,7 +326,7 @@ CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_bu if (gen_host_rec.Init(type)) { Warning("Problems encountered while initializing the Generic Volume"); } - Note("hosting.config finished loading"); + Note("%s finished loading", ts::filename::HOSTING); return 0; } @@ -374,7 +375,7 @@ CacheHostTable::BuildTableFromString(const char *config_file_path, char *file_bu current = current->next; ats_free(last); - Note("hosting.config finished loading"); + Note("%s finished loading", ts::filename::HOSTING); } if (!generic_rec_initd) { @@ -596,11 +597,11 @@ ConfigVolumes::read_config_file() config_path = RecConfigReadConfigPath("proxy.config.cache.volume_filename"); ink_release_assert(config_path); - Note("volume.config loading ..."); + Note("%s loading ...", ts::filename::VOLUME); file_buf = readIntoBuffer(config_path, "[CacheVolition]", nullptr); if (file_buf == nullptr) { - Error("volume.config failed to load"); + Error("%s failed to load", ts::filename::VOLUME); Warning("Cannot read the config file: %s", (const char *)config_path); return; } diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc index 119206f91ad..22592fdb726 100644 --- a/iocore/cache/Store.cc +++ b/iocore/cache/Store.cc @@ -325,13 +325,13 @@ Store::read_config() Span *sd = nullptr, *cur = nullptr; Span *ns; ats_scoped_fd fd; - ats_scoped_str storage_path(RecConfigReadConfigPath(nullptr, STORAGE_CONF_FILENAME)); + ats_scoped_str storage_path(RecConfigReadConfigPath(nullptr, ts::filename::STORAGE)); - Note("%s loading ...", STORAGE_CONF_FILENAME); + Note("%s loading ...", ts::filename::STORAGE); Debug("cache_init", "Store::read_config, fd = -1, \"%s\"", (const char *)storage_path); fd = ::open(storage_path, O_RDONLY); if (fd < 0) { - Error("%s failed to load", STORAGE_CONF_FILENAME); + Error("%s failed to load", ts::filename::STORAGE); return Result::failure("open %s: %s", (const char *)storage_path, strerror(errno)); } @@ -372,7 +372,7 @@ Store::read_config() const char *end; if ((size = ink_atoi64(e, &end)) <= 0 || *end != '\0') { delete sd; - Error("%s failed to load", STORAGE_CONF_FILENAME); + Error("%s failed to load", ts::filename::STORAGE); return Result::failure("failed to parse size '%s'", e); } } else if (0 == strncasecmp(HASH_BASE_STRING_KEY, e, sizeof(HASH_BASE_STRING_KEY) - 1)) { @@ -390,7 +390,7 @@ Store::read_config() } if (!*e || !ParseRules::is_digit(*e) || 0 >= (volume_num = ink_atoi(e))) { delete sd; - Error("%s failed to load", STORAGE_CONF_FILENAME); + Error("%s failed to load", ts::filename::STORAGE); return Result::failure("failed to parse volume number '%s'", e); } } @@ -442,7 +442,7 @@ Store::read_config() sd = nullptr; // these are all used. sort(); - Note("%s finished loading", STORAGE_CONF_FILENAME); + Note("%s finished loading", ts::filename::STORAGE); return Result::ok(); } diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc index 827204b7e32..2ad8c245507 100644 --- a/iocore/dns/SplitDNS.cc +++ b/iocore/dns/SplitDNS.cc @@ -30,6 +30,7 @@ #include "tscore/ink_platform.h" #include "tscore/Tokenizer.h" +#include "tscore/Filenames.h" #ifdef SPLIT_DNS #include @@ -130,7 +131,7 @@ SplitDNSConfig::reconfigure() return; } - Note("splitdns.config loading ..."); + Note("%s loading ...", ts::filename::SPLITDNS); SplitDNS *params = new SplitDNS; @@ -138,7 +139,7 @@ SplitDNSConfig::reconfigure() params->m_DNSSrvrTable = new DNS_table("proxy.config.dns.splitdns.filename", modulePrefix, &sdns_dest_tags); if (nullptr == params->m_DNSSrvrTable || (0 == params->m_DNSSrvrTable->getEntryCount())) { - Error("splitdns.config failed to load"); + Error("%s failed to load", ts::filename::SPLITDNS); Warning("No NAMEDs provided! Disabling SplitDNS"); gsplit_dns_enabled = 0; delete params; @@ -159,7 +160,7 @@ SplitDNSConfig::reconfigure() SplitDNSConfig::print(); } - Note("splitdns.config finished loading"); + Note("%s finished loading", ts::filename::SPLITDNS); } /* -------------------------------------------------------------- @@ -476,7 +477,7 @@ SplitDNSRecord::Init(matcher_line *line_info) } if (!ats_is_ip(&m_servers.x_server_ip[0].sa)) { - return Result::failure("%s No server specified in splitdns.config at line %d", modulePrefix, line_num); + return Result::failure("%s No server specified in %s at line %d", modulePrefix, ts::filename::SPLITDNS, line_num); } DNSHandler *dnsH = new DNSHandler; @@ -505,7 +506,7 @@ SplitDNSRecord::Init(matcher_line *line_info) if (line_info->num_el > 0) { const char *tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in splitdns.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::SPLITDNS); } } diff --git a/iocore/net/QUICMultiCertConfigLoader.cc b/iocore/net/QUICMultiCertConfigLoader.cc index 7e37f3427dc..2b1aecf594d 100644 --- a/iocore/net/QUICMultiCertConfigLoader.cc +++ b/iocore/net/QUICMultiCertConfigLoader.cc @@ -29,6 +29,7 @@ #include "QUICConfig.h" #include "QUICConnection.h" #include "QUICTypes.h" +#include "tscore/Filenames.h" // #include "QUICGlobals.h" #define QUICConfDebug(fmt, ...) Debug("quic_conf", fmt, ##__VA_ARGS__) @@ -128,7 +129,7 @@ QUICMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, c #if TS_USE_TLS_SET_CIPHERSUITES if (params->server_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(ctx, params->server_tls13_cipher_suites)) { - Error("invalid tls server cipher suites in records.config"); + Error("invalid tls server cipher suites in %s", ts::filename::RECORDS); goto fail; } } @@ -141,7 +142,7 @@ QUICMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, c #else if (!SSL_CTX_set1_curves_list(ctx, params->server_groups_list)) { #endif - Error("invalid groups list for server in records.config"); + Error("invalid groups list for server in %s", ts::filename::RECORDS); goto fail; } } diff --git a/iocore/net/SSLClientUtils.cc b/iocore/net/SSLClientUtils.cc index 59f2bce646d..70f36d1740f 100644 --- a/iocore/net/SSLClientUtils.cc +++ b/iocore/net/SSLClientUtils.cc @@ -22,6 +22,7 @@ #include "tscore/ink_config.h" #include "records/I_RecHttp.h" #include "tscore/ink_platform.h" +#include "tscore/Filenames.h" #include "tscore/X509HostnameValidator.h" #include "P_Net.h" @@ -158,7 +159,7 @@ SSLInitClientContext(const SSLConfigParams *params) SSL_CTX_set_options(client_ctx, params->ssl_client_ctx_options); if (params->client_cipherSuite != nullptr) { if (!SSL_CTX_set_cipher_list(client_ctx, params->client_cipherSuite)) { - SSLError("invalid client cipher suite in records.config"); + SSLError("invalid client cipher suite in %s", ts::filename::RECORDS); goto fail; } } @@ -166,7 +167,7 @@ SSLInitClientContext(const SSLConfigParams *params) #if TS_USE_TLS_SET_CIPHERSUITES if (params->client_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(client_ctx, params->client_tls13_cipher_suites)) { - SSLError("invalid tls client cipher suites in records.config"); + SSLError("invalid tls client cipher suites in %s", ts::filename::RECORDS); goto fail; } } @@ -179,7 +180,7 @@ SSLInitClientContext(const SSLConfigParams *params) #else if (!SSL_CTX_set1_curves_list(client_ctx, params->client_groups_list)) { #endif - SSLError("invalid groups list for client in records.config"); + SSLError("invalid groups list for client in %s", ts::filename::RECORDS); goto fail; } } diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc index 9e8b352abbc..b1994c1b920 100644 --- a/iocore/net/SSLUtils.cc +++ b/iocore/net/SSLUtils.cc @@ -27,6 +27,7 @@ #include "tscore/I_Layout.h" #include "tscore/ink_cap.h" #include "tscore/ink_mutex.h" +#include "tscore/Filenames.h" #include "records/I_RecHttp.h" #include "P_Net.h" @@ -962,7 +963,7 @@ SSLPrivateKeyHandler(SSL_CTX *ctx, const SSLConfigParams *params, const std::str SSLConfigParams::load_ssl_file_cb(completeServerKeyPath); } } else { - SSLError("empty SSL private key path in records.config"); + SSLError("empty SSL private key path in %s", ts::filename::RECORDS); return false; } @@ -1328,7 +1329,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co } else { // disable client cert support server_verify_client = SSL_VERIFY_NONE; - Error("illegal client certification level %d in records.config", server_verify_client); + Error("illegal client certification level %d in %s", server_verify_client, ts::filename::RECORDS); } SSL_CTX_set_verify(ctx, server_verify_client, ssl_verify_client_callback); SSL_CTX_set_verify_depth(ctx, params->verify_depth); // might want to make configurable at some point. @@ -1340,7 +1341,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co if (params->cipherSuite != nullptr) { if (!SSL_CTX_set_cipher_list(ctx, params->cipherSuite)) { - SSLError("invalid cipher suite in records.config"); + SSLError("invalid cipher suite in %s", ts::filename::RECORDS); goto fail; } } @@ -1348,7 +1349,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co #if TS_USE_TLS_SET_CIPHERSUITES if (params->server_tls13_cipher_suites != nullptr) { if (!SSL_CTX_set_ciphersuites(ctx, params->server_tls13_cipher_suites)) { - SSLError("invalid tls server cipher suites in records.config"); + SSLError("invalid tls server cipher suites in %s", ts::filename::RECORDS); goto fail; } } @@ -1361,7 +1362,7 @@ SSLMultiCertConfigLoader::init_server_ssl_ctx(std::vector &cert_list, co #else if (!SSL_CTX_set1_curves_list(ctx, params->server_groups_list)) { #endif - SSLError("invalid groups list for server in records.config"); + SSLError("invalid groups list for server in %s", ts::filename::RECORDS); goto fail; } } @@ -1590,7 +1591,7 @@ SSLMultiCertConfigLoader::load(SSLCertLookup *lookup) const matcher_tags sslCertTags = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, false}; - Note("ssl_multicert.config loading ..."); + Note("%s loading ...", ts::filename::SSL_MULTICERT); if (params->configFilePath) { file_buf = readIntoBuffer(params->configFilePath, __func__, nullptr); diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc index 01430b7253e..75b481df963 100644 --- a/lib/records/RecCore.cc +++ b/lib/records/RecCore.cc @@ -219,9 +219,9 @@ RecCoreInit(RecModeT mode_type, Diags *_diags) ink_mutex_init(&g_rec_config_lock); - g_rec_config_fpath = ats_stringdup(RecConfigReadConfigPath(nullptr, RECORDS_CONF_FILENAME)); + g_rec_config_fpath = ats_stringdup(RecConfigReadConfigPath(nullptr, ts::filename::RECORDS)); if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) { - RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", RECORDS_CONF_FILENAME); + RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", ts::filename::RECORDS); file_exists = false; } @@ -1257,7 +1257,7 @@ std::string RecConfigReadPersistentStatsPath() { std::string rundir(RecConfigReadRuntimeDir()); - return Layout::relative_to(rundir, RECORDS_STATS_FILE); + return Layout::relative_to(rundir, ts::filename::RECORDS_STATS); } void diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index 369cfd66e3e..09c9c1ce030 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -750,9 +750,9 @@ LocalManager::processEventQueue() // check if we have a local file update if (mh->msg_id == MGMT_EVENT_CONFIG_FILE_UPDATE) { // records.config - if (!(strcmp(payload.begin(), RECORDS_CONF_FILENAME))) { + if (!(strcmp(payload.begin(), ts::filename::RECORDS))) { if (RecReadConfigFile() != REC_ERR_OKAY) { - mgmt_elog(errno, "[fileUpdated] Config update failed for records.config\n"); + mgmt_elog(errno, "[fileUpdated] Config update failed for %s\n", ts::filename::RECORDS); } else { RecConfigWarnIfUnregistered(); } diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index 55fd6a677a3..3ffda96a191 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -22,6 +22,7 @@ */ #include "tscore/ink_config.h" +#include "tscore/Filenames.h" #include "RecordsConfig.h" #if TS_USE_REMOTE_UNWINDING @@ -420,7 +421,7 @@ static const RecordElement RecordsConfig[] = // ############################## {RECT_CONFIG, "proxy.config.http.parent_proxies", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_STR, ".*", RECA_NULL} , - {RECT_CONFIG, "proxy.config.http.parent_proxy.file", RECD_STRING, "parent.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.http.parent_proxy.file", RECD_STRING, ts::filename::PARENT, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.http.parent_proxy.retry_time", RECD_INT, "300", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , @@ -687,7 +688,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.socks.socks_version", RECD_INT, "4", RECU_RESTART_TS, RR_NULL, RECC_INT, "[4-5]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.socks.socks_config_file", RECD_STRING, "socks.config", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.socks.socks_config_file", RECD_STRING, ts::filename::SOCKS, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.socks.socks_timeout", RECD_INT, "100", RECU_RESTART_TS, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} , @@ -796,13 +797,13 @@ static const RecordElement RecordsConfig[] = //# Cache //# //############################################################################## - {RECT_CONFIG, "proxy.config.cache.control.filename", RECD_STRING, "cache.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.control.filename", RECD_STRING, ts::filename::CACHE, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.ip_allow.filename", RECD_STRING, "ip_allow.yaml", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.ip_allow.filename", RECD_STRING, ts::filename::IP_ALLOW, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.hosting_filename", RECD_STRING, "hosting.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.hosting_filename", RECD_STRING, ts::filename::HOSTING, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.cache.volume_filename", RECD_STRING, "volume.config", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.cache.volume_filename", RECD_STRING, ts::filename::VOLUME, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.cache.permit.pinning", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -879,7 +880,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.dns.splitDNS.enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.dns.splitdns.filename", RECD_STRING, "splitdns.config", RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.dns.splitdns.filename", RECD_STRING, ts::filename::SPLITDNS, RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.dns.nameservers", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , @@ -1000,7 +1001,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.log.logfile_perm", RECD_STRING, "rw-r--r--", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.log.config.filename", RECD_STRING, "logging.yaml", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.log.config.filename", RECD_STRING, ts::filename::LOGGING, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.log.preproc_threads", RECD_INT, "1", RECU_DYNAMIC, RR_REQUIRED, RECC_INT, "[1-128]", RECA_NULL} , @@ -1041,7 +1042,7 @@ static const RecordElement RecordsConfig[] = //############################################################################## {RECT_CONFIG, "proxy.config.reverse_proxy.enabled", RECD_INT, "1", RECU_DYNAMIC, RR_REQUIRED, RECC_INT, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.url_remap.filename", RECD_STRING, "remap.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.url_remap.filename", RECD_STRING, ts::filename::REMAP, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.url_remap.remap_required", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , @@ -1085,11 +1086,11 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.ssl.server.cert_chain.filename", RECD_STRING, nullptr, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , - {RECT_CONFIG, "proxy.config.ssl.server.multicert.filename", RECD_STRING, "ssl_multicert.config", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.ssl.server.multicert.filename", RECD_STRING, ts::filename::SSL_MULTICERT, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.ssl.server.multicert.exit_on_load_fail", RECD_INT, "1", RECU_RESTART_TS, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.ssl.servername.filename", RECD_STRING, "sni.yaml", RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} + {RECT_CONFIG, "proxy.config.ssl.servername.filename", RECD_STRING, ts::filename::SNI, RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.ssl.server.ticket_key.filename", RECD_STRING, nullptr, RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , diff --git a/proxy/CacheControl.cc b/proxy/CacheControl.cc index 072c4709e99..bf1608e33db 100644 --- a/proxy/CacheControl.cc +++ b/proxy/CacheControl.cc @@ -31,6 +31,7 @@ #include #include "tscore/ink_config.h" +#include "tscore/Filenames.h" #include "CacheControl.h" #include "ControlMatcher.h" #include "Main.h" @@ -143,16 +144,16 @@ initCacheControl() void reloadCacheControl() { - Note("cache.config loading ..."); + Note("%s loading ...", ts::filename::CACHE); CC_table *newTable; - Debug("cache_control", "cache.config updated, reloading"); + Debug("cache_control", "%s updated, reloading", ts::filename::CACHE); eventProcessor.schedule_in(new CC_FreerContinuation(CacheControlTable), CACHE_CONTROL_TIMEOUT, ET_CACHE); newTable = new CC_table("proxy.config.cache.control.filename", modulePrefix, &http_dest_tags); ink_atomic_swap(&CacheControlTable, newTable); - Note("cache.config finished loading"); + Note("%s finished loading", ts::filename::CACHE); } void @@ -297,7 +298,7 @@ CacheControlRecord::Init(matcher_line *line_info) directive = CC_IGNORE_SERVER_NO_CACHE; d_found = true; } else { - return Result::failure("%s Invalid action at line %d in cache.config", modulePrefix, line_num); + return Result::failure("%s Invalid action at line %d in %s", modulePrefix, line_num, ts::filename::CACHE); } } else { if (strcasecmp(label, "revalidate") == 0) { @@ -317,7 +318,7 @@ CacheControlRecord::Init(matcher_line *line_info) this->time_arg = time_in; } else { - return Result::failure("%s %s at line %d in cache.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::CACHE); } } } @@ -331,14 +332,14 @@ CacheControlRecord::Init(matcher_line *line_info) } if (d_found == false) { - return Result::failure("%s No directive in cache.config at line %d", modulePrefix, line_num); + return Result::failure("%s No directive in %s at line %d", modulePrefix, ts::filename::CACHE, line_num); } // Process any modifiers to the directive, if they exist if (line_info->num_el > 0) { tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in cache.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::CACHE); } } diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc index 1761a0c7e54..776c8b5fd34 100644 --- a/proxy/IPAllow.cc +++ b/proxy/IPAllow.cc @@ -29,6 +29,7 @@ #include "tscore/BufferWriter.h" #include "tscore/ts_file.h" #include "tscore/ink_memory.h" +#include "tscore/Filenames.h" #include "yaml-cpp/yaml.h" @@ -136,14 +137,14 @@ IpAllow::reconfigure() { self_type *new_table; - Note("ip_allow.yaml loading ..."); + Note("%s loading ...", ts::filename::IP_ALLOW); new_table = new self_type("proxy.config.cache.ip_allow.filename"); new_table->BuildTable(); configid = configProcessor.set(configid, new_table); - Note("ip_allow.yaml finished loading"); + Note("%s finished loading", ts::filename::IP_ALLOW); } IpAllow * diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc index e8a787798d0..27c52c9c531 100644 --- a/proxy/ParentSelection.cc +++ b/proxy/ParentSelection.cc @@ -30,6 +30,7 @@ #include "HTTP.h" #include "HttpTransact.h" #include "I_Machine.h" +#include "tscore/Filenames.h" #define MAX_SIMPLE_RETRIES 5 #define MAX_UNAVAILABLE_SERVER_RETRIES 5 @@ -264,7 +265,7 @@ ParentConfig::startup() void ParentConfig::reconfigure() { - Note("parent.config loading ..."); + Note("%s loading ...", ts::filename::PARENT); ParentConfigParams *params = nullptr; @@ -280,7 +281,7 @@ ParentConfig::reconfigure() ParentConfig::print(); } - Note("parent.config finished loading"); + Note("%s finished loading", ts::filename::PARENT); } // void ParentConfig::print @@ -743,14 +744,14 @@ ParentRecord::Init(matcher_line *line_info) } if (this->parents == nullptr && go_direct == false) { - return Result::failure("%s No parent specified in parent.config at line %d", modulePrefix, line_num); + return Result::failure("%s No parent specified in %s at line %d", modulePrefix, ts::filename::PARENT, line_num); } // Process any modifiers to the directive, if they exist if (line_info->num_el > 0) { tmp = ProcessModifiers(line_info); if (tmp != nullptr) { - return Result::failure("%s %s at line %d in parent.config", modulePrefix, tmp, line_num); + return Result::failure("%s %s at line %d in %s", modulePrefix, tmp, line_num, ts::filename::PARENT); } // record SCHEME modifier if present. // NULL if not present @@ -895,7 +896,7 @@ setup_socks_servers(ParentRecord *rec_arr, int len) void SocksServerConfig::reconfigure() { - Note("socks.config loading ..."); + Note("%s loading ...", ts::filename::SOCKS); char *default_val = nullptr; int retry_time = 30; @@ -935,7 +936,7 @@ SocksServerConfig::reconfigure() SocksServerConfig::print(); } - Note("socks.config finished loading"); + Note("%s finished loading", ts::filename::SOCKS); } void diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc index 4687ddb5528..b658e31c811 100644 --- a/proxy/Plugin.cc +++ b/proxy/Plugin.cc @@ -30,6 +30,7 @@ #include "InkAPIInternal.h" #include "Plugin.h" #include "tscore/ink_cap.h" +#include "tscore/Filenames.h" #define MAX_PLUGIN_ARGS 64 @@ -208,7 +209,7 @@ plugin_expand(char *arg) } not_found: - Warning("plugin.config: unable to find parameter %s", arg); + Warning("%s: unable to find parameter %s", ts::filename::PLUGIN, arg); return nullptr; } @@ -231,11 +232,11 @@ plugin_init(bool validateOnly) INIT_ONCE = false; } - Note("plugin.config loading ..."); - path = RecConfigReadConfigPath(nullptr, "plugin.config"); + Note("%s loading ...", ts::filename::PLUGIN); + path = RecConfigReadConfigPath(nullptr, ts::filename::PLUGIN); fd = open(path, O_RDONLY); if (fd < 0) { - Warning("plugin.config failed to load: %d, %s", errno, strerror(errno)); + Warning("%s failed to load: %d, %s", ts::filename::PLUGIN, errno, strerror(errno)); return false; } @@ -311,9 +312,9 @@ plugin_init(bool validateOnly) close(fd); if (retVal) { - Note("plugin.config finished loading"); + Note("%s finished loading", ts::filename::PLUGIN); } else { - Error("plugin.config failed to load"); + Error("%s failed to load", ts::filename::PLUGIN); } return retVal; } diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc index 2f5de1a917b..0d68c8beb2a 100644 --- a/proxy/ReverseProxy.cc +++ b/proxy/ReverseProxy.cc @@ -28,6 +28,7 @@ */ #include "tscore/ink_platform.h" +#include "tscore/Filenames.h" #include #include "P_EventSystem.h" #include "P_Cache.h" @@ -64,11 +65,11 @@ init_reverse_proxy() reconfig_mutex = new_ProxyMutex(); rewrite_table = new UrlRewrite(); - Note("remap.config loading ..."); + Note("%s loading ...", ts::filename::REMAP); if (!rewrite_table->load()) { - Fatal("remap.config failed to load"); + Fatal("%s failed to load", ts::filename::REMAP); } - Note("remap.config finished loading"); + Note("%s finished loading", ts::filename::REMAP); REC_RegisterConfigUpdateFunc("proxy.config.url_remap.filename", url_rewrite_CB, (void *)FILE_CHANGED); REC_RegisterConfigUpdateFunc("proxy.config.proxy_name", url_rewrite_CB, (void *)TSNAME_CHANGED); @@ -136,11 +137,11 @@ reloadUrlRewrite() { UrlRewrite *newTable, *oldTable; - Note("remap.config loading ..."); - Debug("url_rewrite", "remap.config updated, reloading..."); + Note("%s loading ...", ts::filename::REMAP); + Debug("url_rewrite", "%s updated, reloading...", ts::filename::REMAP); newTable = new UrlRewrite(); if (newTable->load()) { - static const char *msg = "remap.config finished loading"; + static const char *msg = "%s finished loading"; // Hold at least one lease, until we reload the configuration newTable->acquire(); @@ -154,15 +155,15 @@ reloadUrlRewrite() oldTable->pluginFactory.deactivate(); oldTable->release(); - Debug("url_rewrite", "%s", msg); + Debug("url_rewrite", msg, ts::filename::REMAP); Note("%s", msg); return true; } else { - static const char *msg = "remap.config failed to load"; + static const char *msg = "%s failed to load"; delete newTable; - Debug("url_rewrite", "%s", msg); - Error("%s", msg); + Debug("url_rewrite", msg, ts::filename::REMAP); + Error(msg, ts::filename::REMAP); return false; } } diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc index 65b44c2d287..a13d06daf57 100644 --- a/proxy/http/HttpBodyFactory.cc +++ b/proxy/http/HttpBodyFactory.cc @@ -31,6 +31,7 @@ #include "tscore/ink_platform.h" #include "tscore/ink_sprintf.h" #include "tscore/ink_file.h" +#include "tscore/Filenames.h" #include "HttpBodyFactory.h" #include #include @@ -334,7 +335,7 @@ HttpBodyFactory::HttpBodyFactory() for (i = 0; config_record_names[i] != nullptr; i++) { status = REC_RegisterConfigUpdateFunc(config_record_names[i], config_callback, (void *)this); if (status != REC_ERR_OKAY) { - Warning("couldn't register variable '%s', is records.config up to date?", config_record_names[i]); + Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], ts::filename::RECORDS); } no_registrations_failed = no_registrations_failed && (status == REC_ERR_OKAY); } diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index fa0b494aea9..6ee3c46d5b7 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -22,6 +22,7 @@ */ #include "tscore/ink_config.h" +#include "tscore/Filenames.h" #include #include #include "HttpConfig.h" @@ -1302,9 +1303,9 @@ HttpConfig::reconfigure() if (params->outbound_conntrack.queue_size > 0 && !(params->oride.outbound_conntrack.max > 0 || params->oride.outbound_conntrack.min > 0)) { Warning("'%s' is set, but neither '%s' nor '%s' are " - "set, please correct your records.config", + "set, please correct your %s", OutboundConnTrack::CONFIG_VAR_QUEUE_SIZE.data(), OutboundConnTrack::CONFIG_VAR_MAX.data(), - OutboundConnTrack::CONFIG_VAR_MIN.data()); + OutboundConnTrack::CONFIG_VAR_MIN.data(), ts::filename::RECORDS); } params->oride.attach_server_session_to_client = m_master.oride.attach_server_session_to_client; @@ -1312,8 +1313,8 @@ HttpConfig::reconfigure() params->http_hdr_field_max_size = m_master.http_hdr_field_max_size; if (params->oride.outbound_conntrack.max > 0 && params->oride.outbound_conntrack.max < params->oride.outbound_conntrack.min) { - Warning("'%s' < per_server.min_keep_alive_connections, setting min=max , please correct your records.config", - OutboundConnTrack::CONFIG_VAR_MAX.data()); + Warning("'%s' < per_server.min_keep_alive_connections, setting min=max , please correct your %s", + OutboundConnTrack::CONFIG_VAR_MAX.data(), ts::filename::RECORDS); params->oride.outbound_conntrack.min = params->oride.outbound_conntrack.max; } diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index e31430a54ae..d3b670219fb 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -33,6 +33,7 @@ #include "HttpDebugNames.h" #include #include "tscore/ParseRules.h" +#include "tscore/Filenames.h" #include "HTTP.h" #include "HdrUtils.h" #include "logging/Log.h" @@ -6061,8 +6062,8 @@ HttpTransact::is_response_cacheable(State *s, HTTPHdr *request, HTTPHdr *respons // If a ttl is set, allow caching even if response contains // Cache-Control headers to prevent caching if (s->cache_control.ttl_in_cache > 0) { - TxnDebug("http_trans", - "[is_response_cacheable] Cache-control header directives in response overridden by ttl in cache.config"); + TxnDebug("http_trans", "[is_response_cacheable] Cache-control header directives in response overridden by ttl in %s", + ts::filename::CACHE); } else { TxnDebug("http_trans", "[is_response_cacheable] NO by response cache control"); return false; diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc index 39052138174..c0dc69b5da5 100644 --- a/proxy/http/remap/UrlRewrite.cc +++ b/proxy/http/remap/UrlRewrite.cc @@ -27,6 +27,7 @@ #include "ReverseProxy.h" #include "RemapConfig.h" #include "tscore/I_Layout.h" +#include "tscore/Filenames.h" #include "HttpSM.h" #define modulePrefix "[ReverseProxy]" @@ -55,10 +56,10 @@ UrlRewrite::load() { ats_scoped_str config_file_path; - config_file_path = RecConfigReadConfigPath("proxy.config.url_remap.filename", "remap.config"); + config_file_path = RecConfigReadConfigPath("proxy.config.url_remap.filename", ts::filename::REMAP); if (!config_file_path) { pmgmt->signalManager(MGMT_SIGNAL_CONFIG_ERROR, "Unable to find proxy.config.url_remap.filename"); - Warning("%s Unable to locate remap.config. No remappings in effect", modulePrefix); + Warning("%s Unable to locate %s. No remappings in effect", modulePrefix, ts::filename::REMAP); return false; } diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc index 77d517147da..6500bc1dc69 100644 --- a/proxy/logging/LogConfig.cc +++ b/proxy/logging/LogConfig.cc @@ -34,6 +34,7 @@ #include "tscore/ink_file.h" #include "tscore/List.h" +#include "tscore/Filenames.h" #include "Log.h" #include "LogField.h" @@ -806,7 +807,7 @@ LogConfig::update_space_used() bool LogConfig::evaluate_config() { - ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", "logging.yaml")); + ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", ts::filename::LOGGING)); struct stat sbuf; if (stat(path.get(), &sbuf) == -1 && errno == ENOENT) { Warning("logging configuration '%s' doesn't exist", path.get()); diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc index b1ce1fe33cb..2246dc89631 100644 --- a/proxy/shared/DiagsConfig.cc +++ b/proxy/shared/DiagsConfig.cc @@ -25,6 +25,7 @@ #include "tscore/ink_memory.h" #include "tscore/ink_file.h" #include "tscore/I_Layout.h" +#include "tscore/Filenames.h" #include "DiagsConfig.h" #include "records/P_RecCore.h" @@ -337,7 +338,7 @@ DiagsConfig::register_diags_callbacks() for (i = 0; config_record_names[i] != nullptr; i++) { status = (REC_RegisterConfigUpdateFunc(config_record_names[i], diags_config_callback, o) == REC_ERR_OKAY); if (!status) { - Warning("couldn't register variable '%s', is records.config up to date?", config_record_names[i]); + Warning("couldn't register variable '%s', is %s up to date?", config_record_names[i], ts::filename::RECORDS); } total_status = total_status && status; } diff --git a/src/traffic_layout/info.cc b/src/traffic_layout/info.cc index 64afb6110db..736e2879c0b 100644 --- a/src/traffic_layout/info.cc +++ b/src/traffic_layout/info.cc @@ -155,14 +155,14 @@ produce_layout(bool json) print_var("PLUGINDIR", RecConfigReadPluginDir(), json); print_var("INCLUDEDIR", Layout::get()->includedir, json); - print_var(RECORDS_CONF_FILENAME, RecConfigReadConfigPath(nullptr, RECORDS_CONF_FILENAME), json); - print_var("remap.config", RecConfigReadConfigPath("proxy.config.url_remap.filename"), json); - print_var("plugin.config", RecConfigReadConfigPath(nullptr, "plugin.config"), json); - print_var("ssl_multicert.config", RecConfigReadConfigPath("proxy.config.ssl.server.multicert.filename"), json); - print_var(STORAGE_CONF_FILENAME, RecConfigReadConfigPath(nullptr, STORAGE_CONF_FILENAME), json); - print_var("hosting.config", RecConfigReadConfigPath("proxy.config.cache.hosting_filename"), json); - print_var("volume.config", RecConfigReadConfigPath("proxy.config.cache.volume_filename"), json); - print_var("ip_allow.yaml", RecConfigReadConfigPath("proxy.config.cache.ip_allow.filename"), json, true); + print_var(ts::filename::RECORDS, RecConfigReadConfigPath(nullptr, ts::filename::RECORDS), json); + print_var(ts::filename::REMAP, RecConfigReadConfigPath("proxy.config.url_remap.filename"), json); + print_var(ts::filename::PLUGIN, RecConfigReadConfigPath(nullptr, ts::filename::PLUGIN), json); + print_var(ts::filename::SSL_MULTICERT, RecConfigReadConfigPath("proxy.config.ssl.server.multicert.filename"), json); + print_var(ts::filename::STORAGE, RecConfigReadConfigPath(nullptr, ts::filename::STORAGE), json); + print_var(ts::filename::HOSTING, RecConfigReadConfigPath("proxy.config.cache.hosting_filename"), json); + print_var(ts::filename::VOLUME, RecConfigReadConfigPath("proxy.config.cache.volume_filename"), json); + print_var(ts::filename::IP_ALLOW, RecConfigReadConfigPath("proxy.config.cache.ip_allow.filename"), json, true); if (json) { printf("}\n"); } diff --git a/src/traffic_manager/AddConfigFilesHere.cc b/src/traffic_manager/AddConfigFilesHere.cc index 553c050d00c..be91a826603 100644 --- a/src/traffic_manager/AddConfigFilesHere.cc +++ b/src/traffic_manager/AddConfigFilesHere.cc @@ -73,20 +73,20 @@ initializeRegistry() ink_assert(!"Configuration Object Registry Initialized More than Once"); } - registerFile("proxy.config.log.config.filename", "logging.yaml"); - registerFile("", STORAGE_CONF_FILENAME); - registerFile("proxy.config.socks.socks_config_file", "socks.config"); - registerFile(RECORDS_CONF_FILENAME, RECORDS_CONF_FILENAME); - registerFile("proxy.config.cache.control.filename", "cache.config"); - registerFile("proxy.config.cache.ip_allow.filename", "ip_allow.yaml"); - registerFile("proxy.config.http.parent_proxy.file", "parent.config"); - registerFile("proxy.config.url_remap.filename", "remap.config"); - registerFile("", "volume.config"); - registerFile("proxy.config.cache.hosting_filename", "hosting.config"); - registerFile("", "plugin.config"); - registerFile("proxy.config.dns.splitdns.filename", "splitdns.config"); - registerFile("proxy.config.ssl.server.multicert.filename", "ssl_multicert.config"); - registerFile("proxy.config.ssl.servername.filename", "sni.config"); + registerFile("proxy.config.log.config.filename", ts::filename::LOGGING); + registerFile("", ts::filename::STORAGE); + registerFile("proxy.config.socks.socks_config_file", ts::filename::SOCKS); + registerFile(ts::filename::RECORDS, ts::filename::RECORDS); + registerFile("proxy.config.cache.control.filename", ts::filename::CACHE); + registerFile("proxy.config.cache.ip_allow.filename", ts::filename::IP_ALLOW); + registerFile("proxy.config.http.parent_proxy.file", ts::filename::PARENT); + registerFile("proxy.config.url_remap.filename", ts::filename::REMAP); + registerFile("", ts::filename::VOLUME); + registerFile("proxy.config.cache.hosting_filename", ts::filename::HOSTING); + registerFile("", ts::filename::PLUGIN); + registerFile("proxy.config.dns.splitdns.filename", ts::filename::SPLITDNS); + registerFile("proxy.config.ssl.server.multicert.filename", ts::filename::SSL_MULTICERT); + registerFile("proxy.config.ssl.servername.filename", ts::filename::SNI); configFiles->registerCallback(testcall); } diff --git a/src/traffic_manager/traffic_manager.cc b/src/traffic_manager/traffic_manager.cc index ccbf1626267..152ab78280c 100644 --- a/src/traffic_manager/traffic_manager.cc +++ b/src/traffic_manager/traffic_manager.cc @@ -91,7 +91,7 @@ static char bind_stderr[512] = ""; static const char *mgmt_path = nullptr; // By default, set the current directory as base -static const char *recs_conf = RECORDS_CONF_FILENAME; +static const char *recs_conf = ts::filename::RECORDS; static int fds_limit; diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc index d6713a8180b..685da749bb1 100644 --- a/src/traffic_server/InkAPITest.cc +++ b/src/traffic_server/InkAPITest.cc @@ -40,6 +40,7 @@ #include "tscore/ink_sprintf.h" #include "tscore/ink_file.h" #include "tscore/Regression.h" +#include "tscore/Filenames.h" #include "ts/ts.h" #include "ts/experimental.h" #include "records/I_RecCore.h" @@ -1995,7 +1996,6 @@ REGRESSION_TEST(SDK_API_TSCache)(RegressionTest *test, int /* atype ATS_UNUSED * // TSfread // TSfwrite ////////////////////////////////////////////// -#define PFX "plugin.config" // Note that for each test, if it fails, we set the error status and return. REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus) @@ -2013,8 +2013,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * struct stat stat_buffer_pre, stat_buffer_post, stat_buffer_input; char *ret_val; int read = 0, wrote = 0; - int64_t read_amount = 0; - char INPUT_TEXT_FILE[] = "plugin.config"; + int64_t read_amount = 0; char input_file_full_path[BUFSIZ]; // Set full path to file at run time. @@ -2027,7 +2026,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * return; } // Add "etc/trafficserver" to point to config directory - ink_filepath_make(input_file_full_path, sizeof(input_file_full_path), TSConfigDirGet(), INPUT_TEXT_FILE); + ink_filepath_make(input_file_full_path, sizeof(input_file_full_path), TSConfigDirGet(), ts::filename::PLUGIN); // open existing file for reading if (!(source_read_file = TSfopen(input_file_full_path, "r"))) { @@ -2041,7 +2040,7 @@ REGRESSION_TEST(SDK_API_TSfopen)(RegressionTest *test, int /* atype ATS_UNUSED * } // Create unique tmp _file_name_, do not use any TS file_name - snprintf(write_file_name, PATH_NAME_MAX, "/tmp/%sXXXXXX", PFX); + snprintf(write_file_name, PATH_NAME_MAX, "/tmp/%sXXXXXX", ts::filename::PLUGIN); int write_file_fd; // this file will be reopened below if ((write_file_fd = mkstemp(write_file_name)) <= 0) { SDK_RPRINT(test, "mkstemp", "std func", TC_FAIL, "can't create file for writing"); diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 07d46ad740a..1a934cc67b1 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -38,6 +38,7 @@ #include "tscore/ink_syslog.h" #include "tscore/hugepages.h" #include "tscore/runroot.h" +#include "tscore/Filenames.h" #include "ts/ts.h" // This is sadly needed because of us using TSThreadInit() for some reason. @@ -857,23 +858,23 @@ cmd_verify(char * /* cmd ATS_UNUSED */) if (!urlRewriteVerify()) { exitStatus |= (1 << 0); - fprintf(stderr, "ERROR: Failed to load remap.config, exitStatus %d\n\n", exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", ts::filename::REMAP, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded remap.config\n\n"); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", ts::filename::REMAP); } if (RecReadConfigFile() != REC_ERR_OKAY) { exitStatus |= (1 << 1); - fprintf(stderr, "ERROR: Failed to load records.config, exitStatus %d\n\n", exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", ts::filename::RECORDS, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded records.config\n\n"); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", ts::filename::RECORDS); } if (!plugin_init(true)) { exitStatus |= (1 << 2); - fprintf(stderr, "ERROR: Failed to load plugin.config, exitStatus %d\n\n", exitStatus); + fprintf(stderr, "ERROR: Failed to load %s, exitStatus %d\n\n", ts::filename::PLUGIN, exitStatus); } else { - fprintf(stderr, "INFO: Successfully loaded plugin.config\n\n"); + fprintf(stderr, "INFO: Successfully loaded %s\n\n", ts::filename::PLUGIN); } SSLInitializeLibrary(); @@ -1304,7 +1305,7 @@ syslog_log_configure() ats_free(facility_str); if (facility < 0) { - syslog(LOG_WARNING, "Bad syslog facility in records.config. Keeping syslog at LOG_DAEMON"); + syslog(LOG_WARNING, "Bad syslog facility in %s. Keeping syslog at LOG_DAEMON", ts::filename::RECORDS); } else { Debug("server", "Setting syslog facility to %d", facility); closelog(); @@ -1474,7 +1475,8 @@ change_uid_gid(const char *user) "\tand then rebuild the server.\n" "\tIt is strongly suggested that you instead modify the\n" "\tproxy.config.admin.user_id directive in your\n" - "\trecords.config file to list a non-root user.\n"); + "\t%s file to list a non-root user.\n", + ts::filename::RECORDS); } #endif } @@ -2098,13 +2100,13 @@ init_ssl_ctx_callback(void *ctx, bool server) static void load_ssl_file_callback(const char *ssl_file) { - pmgmt->signalConfigFileChild("ssl_multicert.config", ssl_file); + pmgmt->signalConfigFileChild(ts::filename::SSL_MULTICERT, ssl_file); } static void load_remap_file_callback(const char *remap_file) { - pmgmt->signalConfigFileChild("remap.config", remap_file); + pmgmt->signalConfigFileChild(ts::filename::REMAP, remap_file); } static void diff --git a/src/tscore/Filenames.cc b/src/tscore/Filenames.cc deleted file mode 100644 index 018804c7ffe..00000000000 --- a/src/tscore/Filenames.cc +++ /dev/null @@ -1,29 +0,0 @@ -/** @file - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -/////////////////////////////////////////////////////////////////// -// Configuration file names -const char *STORAGE_CONF_FILENAME = "storage.config"; -const char *RECORDS_CONF_FILENAME = "records.config"; - -/////////////////////////////////////////////////////////////////// -// Various other file names -const char *RECORDS_STATS_FILE = "records.snap"; diff --git a/src/tscore/Makefile.am b/src/tscore/Makefile.am index faa2fc02ca3..c342179c890 100644 --- a/src/tscore/Makefile.am +++ b/src/tscore/Makefile.am @@ -64,7 +64,6 @@ libtscore_la_SOURCES = \ EventNotify.cc \ Extendible.cc \ fastlz.c \ - Filenames.cc \ Hash.cc \ HashFNV.cc \ HashMD5.cc \ diff --git a/src/tscore/unit_tests/test_layout.cc b/src/tscore/unit_tests/test_layout.cc index bd25517b798..736393bd847 100644 --- a/src/tscore/unit_tests/test_layout.cc +++ b/src/tscore/unit_tests/test_layout.cc @@ -80,8 +80,8 @@ TEST_CASE("relative to test", "[relative_to]") // relative to (4 parameters) char config_file[PATH_NAME_MAX]; - Layout::relative_to(config_file, sizeof(config_file), Layout::get()->sysconfdir, RECORDS_CONF_FILENAME); - std::string a = Layout::relative_to(Layout::get()->sysconfdir, RECORDS_CONF_FILENAME); + Layout::relative_to(config_file, sizeof(config_file), Layout::get()->sysconfdir, ts::filename::RECORDS); + std::string a = Layout::relative_to(Layout::get()->sysconfdir, ts::filename::RECORDS); std::string b = config_file; REQUIRE(a == b); }