#!/home/server/bin/perl
#
# 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.

use Apache::TS::Config::Records;
use File::Copy;

chdir("/home/server");

my $recedit = new Apache::TS::Config::Records(file => "etc/trafficserver/records.config");

$recedit->set(conf => "proxy.config.exec_thread.autoconfig",  val => "0");
$recedit->set(conf => "proxy.config.exec_thread.limit",  val => "2"); # I'm lightweight ...
$recedit->set(conf => "proxy.config.http.server_port",		val => "80");
$recedit->set(conf => "proxy.config.cache.ram_cache.size",  val => "128M");
$recedit->set(conf => "proxy.config.cache.ram_cache_cutoff",  val => "1M");
$recedit->set(conf => "proxy.config.url_remap.remap_required",  val => "1");
$recedit->set(conf => "proxy.config.url_remap.pristine_host_hdr",  val => "0");
$recedit->set(conf => "proxy.config.http.insert_response_via_str",  val => "1");
$recedit->set(conf => "proxy.config.http.accept_no_activity_timeout",  val => "30");
$recedit->set(conf => "proxy.config.http.keep_alive_no_activity_timeout_out",  val => "5");
$recedit->set(conf => "proxy.config.http.negative_caching_enabled",  val => "1");
$recedit->set(conf => "proxy.config.http.negative_caching_lifetime",  val => "120");
$recedit->set(conf => "proxy.config.http.cache.ignore_client_cc_max_age",  val => "1");
$recedit->set(conf => "proxy.config.http.normalize_ae_gzip",  val => "1");
$recedit->set(conf => "proxy.config.dns.search_default_domains",  val => "0");
$recedit->set(conf => "proxy.config.hostdb.size",  val => "1000");
$recedit->set(conf => "proxy.config.hostdb.storage_size",  val => "1M");
$recedit->set(conf => "proxy.config.ssl.enabled",  val => "0");
$recedit->set(conf => "proxy.config.ssl.number.threads",  val => "0");

$recedit->append(line => "");
$recedit->append(line => "# My local stuff");
$recedit->set(conf => "proxy.config.http.server_max_connections", val =>"100");
$recedit->set(conf => "proxy.config.http_ui_enabled", val => "3");
$recedit->set(conf => "proxy.config.mlock_enabled", val => "2");

$recedit->write(file => "etc/trafficserver/records.config");

# Some copies
my $src = "/home/server/ATS";

copy("$src/remap.config", "etc/trafficserver");
copy("$src/storage.config", "etc/trafficserver");
copy("$src/plugin.config", "etc/trafficserver");
