<commit_before>/**
 * Copyright 2016 Netflix, Inc.
 *
 * Licensed 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.
 */
package com.netflix.dynomitemanager.defaultimpl;

import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.AmazonEC2Client;
import com.amazonaws.services.ec2.model.*;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.netflix.dynomitemanager.sidecore.IConfiguration;
import com.netflix.dynomitemanager.sidecore.ICredential;
import com.netflix.dynomitemanager.sidecore.IConfigSource;
import com.netflix.dynomitemanager.sidecore.config.InstanceDataRetriever;
import com.netflix.dynomitemanager.sidecore.utils.SystemUtils;
import com.netflix.dynomitemanager.sidecore.utils.RetryableCallable;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;


@Singleton
public class DynomitemanagerConfiguration implements IConfiguration
{
    public static final String DYNOMITEMANAGER_PRE = "florida";
    
    public static final int DYNO_MEMCACHED = 0;
    public static final int DYNO_REDIS     = 1;
    public static final String DYNO_REDIS_CONF_PATH = "/apps/nfredis/conf/redis.conf";
    public static final int DYNO_PORT = 8102;
    public static final int REDIS_PORT = 22122;
    public final static String LOCAL_ADDRESS = "127.0.0.1";

    private static final String CONFIG_DYN_HOME_DIR                    = DYNOMITEMANAGER_PRE + ".dyno.home";
    private static final String CONFIG_DYN_START_SCRIPT                = DYNOMITEMANAGER_PRE + ".dyno.startscript";
    private static final String CONFIG_DYN_STOP_SCRIPT                 = DYNOMITEMANAGER_PRE + ".dyno.stopscript";
    
    private static final String CONFIG_CLUSTER_NAME                    = DYNOMITEMANAGER_PRE + ".dyno.clustername";
    private static final String CONFIG_SEED_PROVIDER_NAME              = DYNOMITEMANAGER_PRE + ".dyno.seed.provider";
    private static final String CONFIG_DYN_LISTENER_PORT_NAME          = DYNOMITEMANAGER_PRE + ".dyno.port";
    private static final String CONFIG_DYN_PEER_PORT_NAME              = DYNOMITEMANAGER_PRE + ".dyno.peer.port";
    private static final String CONFIG_DYN_SECURED_PEER_PORT_NAME      = DYNOMITEMANAGER_PRE + ".dyno.secured.peer.port";
    private static final String CONFIG_RACK_NAME                       = DYNOMITEMANAGER_PRE + ".dyno.rack";
    private static final String CONFIG_USE_ASG_FOR_RACK_NAME           = DYNOMITEMANAGER_PRE + ".dyno.asg.rack";
    private static final String CONFIG_TOKENS_DISTRIBUTION_NAME        = DYNOMITEMANAGER_PRE + ".dyno.tokens.distribution";
    private static final String CONFIG_DYNO_REQ_TIMEOUT_NAME           = DYNOMITEMANAGER_PRE + ".dyno.request.timeout";   //in milliseconds
    private static final String CONFIG_DYNO_GOSSIP_INTERVAL_NAME       = DYNOMITEMANAGER_PRE + ".dyno.gossip.interval"; //in milliseconds
    private static final String CONFIG_DYNO_TOKENS_HASH_NAME           = DYNOMITEMANAGER_PRE + ".dyno.tokens.hash";
    private static final String CONFIG_DYNO_CONNECTIONS_PRECONNECT     = DYNOMITEMANAGER_PRE + ".dyno.connections.preconnect";
    private static final String CONFIG_DYNO_CLUSTER_TYPE               = DYNOMITEMANAGER_PRE + ".dyno.cluster.type";
    private static final String CONFIG_DYNO_IS_MULTI_REGIONED_CLUSTER  = DYNOMITEMANAGER_PRE + ".dyno.multiregion";
    private static final String CONFIG_DYNO_HEALTHCHECK_ENABLE         = DYNOMITEMANAGER_PRE + ".dyno.healthcheck.enable";
    /** The max percentage of system memory to be allocated to the Dynomite fronted data store. */
    private static final String CONFIG_DYNO_STORAGE_MEM_PCT_INT        = DYNOMITEMANAGER_PRE + ".dyno.storage.mem.pct.int";
    
    private static final String CONFIG_DYNO_MBUF_SIZE                  = DYNOMITEMANAGER_PRE + ".dyno.mbuf.size";
    private static final String CONFIG_DYNO_MAX_ALLOC_MSGS			   = DYNOMITEMANAGER_PRE + ".dyno.allocated.messages";	

    private static final String CONFIG_AVAILABILITY_ZONES              = DYNOMITEMANAGER_PRE + ".zones.available";
    private static final String CONFIG_AVAILABILITY_RACKS              = DYNOMITEMANAGER_PRE + ".racks.available";

    private static final String CONFIG_DYN_PROCESS_NAME                = DYNOMITEMANAGER_PRE + ".dyno.processname";
    private static final String CONFIG_YAML_LOCATION                   = DYNOMITEMANAGER_PRE + ".yamlLocation";
    private static final String CONFIG_METADATA_KEYSPACE               = DYNOMITEMANAGER_PRE + ".metadata.keyspace";
    private static final String CONFIG_SECURED_OPTION                  = DYNOMITEMANAGER_PRE + ".secured.option";
    private static final String CONFIG_DYNO_AUTO_EJECT_HOSTS           = DYNOMITEMANAGER_PRE + ".auto.eject.hosts";
   
    // Cassandra Cluster for token management
    private static final String CONFIG_BOOTCLUSTER_NAME                = DYNOMITEMANAGER_PRE + ".bootcluster";
    private static final String CONFIG_CASSANDRA_KEYSPACE_NAME         = DYNOMITEMANAGER_PRE + ".cassandra.keyspace.name";
    private static final String CONFIG_CASSANDRA_THRIFT_PORT           = DYNOMITEMANAGER_PRE + ".cassandra.thrift.port";
    private static final String CONFIG_COMMA_SEPARATED_CASSANDRA_HOSTNAMES = DYNOMITEMANAGER_PRE + ".cassandra.comma.separated.hostnames";

    // Eureka
    private static final String CONFIG_IS_EUREKA_HOST_SUPPLIER_ENABLED = DYNOMITEMANAGER_PRE + ".eureka.host.supplier.enabled";


    // Amazon specific
    private static final String CONFIG_ASG_NAME = DYNOMITEMANAGER_PRE + ".az.asgname";
    private static final String CONFIG_REGION_NAME = DYNOMITEMANAGER_PRE + ".az.region";
    private static final String CONFIG_ACL_GROUP_NAME = DYNOMITEMANAGER_PRE + ".acl.groupname";
    private static final String CONFIG_VPC = DYNOMITEMANAGER_PRE + ".vpc";
    
    /* Dynomite Consistency */
    private static final String CONFIG_DYNO_READ_CONS 	               = DYNOMITEMANAGER_PRE + ".dyno.read.consistency";
    private static final String CONFIG_DYNO_WRITE_CONS                 = DYNOMITEMANAGER_PRE + ".dyno.write.consistency";
    
    // warm up
    private static final String CONFIG_DYNO_WARM_BOOTSTRAP             = DYNOMITEMANAGER_PRE + ".dyno.warm.bootstrap";
    private static final String CONFIG_DYNO_ALLOWABLE_BYTES_SYNC_DIFF  = DYNOMITEMANAGER_PRE + ".dyno.warm.bytes.sync.diff";
    private static final String CONFIG_DYNO_MAX_TIME_BOOTSTRAP		   = DYNOMITEMANAGER_PRE + ".dyno.warm.msec.bootstraptime";
    
    // Backup and Restore
    private static final String CONFIG_BACKUP_ENABLED                  = DYNOMITEMANAGER_PRE + ".dyno.backup.snapshot.enabled";
    private static final String CONFIG_RESTORE_ENABLED                 = DYNOMITEMANAGER_PRE + ".dyno.backup.restore.enabled";
    private static final String CONFIG_AOF_DIR                         = DYNOMITEMANAGER_PRE + ".dyno.backup.aof.directory";
    private static final String CONFIG_BUCKET_NAME                     = DYNOMITEMANAGER_PRE + ".dyno.backup.bucket.name";    
    private static final String CONFIG_S3_BASE_DIR                     = DYNOMITEMANAGER_PRE + ".dyno.backup.s3.base_dir";
    private static final String CONFIG_BACKUP_HOUR                     = DYNOMITEMANAGER_PRE + ".dyno.backup.hour";
    private static final String CONFIG_RESTORE_TIME					   = DYNOMITEMANAGER_PRE + ".dyno.backup.restore.date";
    
    // persistence
    private static final String CONFIG_PERSISTENCE_AOF_ENABLED         = DYNOMITEMANAGER_PRE + ".dyno.persistence.aof.enabled";


    // Defaults 
    private final String DEFAULT_CLUSTER_NAME = "dynomite_demo1";
    private final String DEFAULT_SEED_PROVIDER = "dynomitemanager_provider";
    private final String DEFAULT_DYN_HOME_DIR = "/apps/dynomite";
    private final String DEFAULT_DYN_START_SCRIPT = "/apps/dynomite/bin/launch_dynomite.sh";
    private final String DEFAULT_DYN_STOP_SCRIPT = "/apps/dynomite/bin/kill_dynomite.sh";
    
    private final String DEFAULT_MEMCACHED_START_SCRIPT = "/apps/memcached/bin/memcached";
    private final String DEFAULT_MEMCACHED_STOP_SCRIPT = "/usr/bin/pkill memcached";
    
    private final String DEFAULT_REDIS_START_SCRIPT = "/apps/nfredis/bin/launch_nfredis.sh";
    private final String DEFAULT_REDIS_STOP_SCRIPT = "/apps/nfredis/bin/kill_redis.sh";
    
    
    private List<String> DEFAULT_AVAILABILITY_ZONES = ImmutableList.of();
    private List<String> DEFAULT_AVAILABILITY_RACKS = ImmutableList.of();

    private final String DEFAULT_DYN_PROCESS_NAME = "dynomite";
    private final int DEFAULT_DYN_LISTENER_PORT = 8102;
    private final int DEFAULT_DYN_SECURED_PEER_PORT = 8101;
    private final int DEFAULT_DYN_PEER_PORT = 8101;
    private final int DEFAULT_DYN_MEMCACHED_PORT = 11211;
    private final String DEFAULT_DYN_RACK = "RAC1";
    private final String DEFAULT_TOKENS_DISTRIBUTION = "vnode";
    private final int DEFAULT_DYNO_REQ_TIMEOUT_IN_MILLISEC = 5000;
    private final int DEFAULT_DYNO_GOSSIP_INTERVAL = 10000;
    private final String DEFAULT_DYNO_TOKENS_HASH = "<PASSWORD>";
    private final int DEFAULT_DYNO_CLUSTER_TYPE = JedisConfiguration.DYNO_REDIS; //redis
    
    
    private final String DEFAULT_METADATA_KEYSPACE = "dyno_bootstrap";
    private final String DEFAULT_SECURED_OPTION    = "datacenter";
    
    // Backup & Restore
    private static final boolean DEFAULT_BACKUP_ENABLED = false;
    private static final boolean DEFAULT_RESTORE_ENABLED = false;
    private static final String DEFAULT_AOF_LOCATION = "/mnt/data/nfredis";
    private static final String DEFAULT_BUCKET_NAME = "us-east-1.dynomite-backup-test";
    private static final String DEFAULT_BUCKET_FOLDER = "backup";
    private static final String DEFAULT_RESTORE_REPOSITORY_TYPE = "s3";
   
    private static final String DEFAULT_RESTORE_SNAPSHOT_NAME = "";
    private static final String DEFAULT_RESTORE_SOURCE_REPO_REGION = "us-east-1";
    private static final String DEFAULT_RESTORE_SOURCE_CLUSTER_NAME = "";
    private static final String DEFAULT_RESTORE_REPOSITORY_NAME = "testrepo";
    private static final String DEFAULT_RESTORE_TIME ="20101010";
    private static final int DEFAULT_BACKUP_HOUR = 12;
    
    // Persistence
    private static final boolean DEFAULT_PERSISTENCE_AOF_ENABLED = false;
   
    private static final Logger logger = LoggerFactory.getLogger(DynomitemanagerConfiguration.class);

    
    private final String CLUSTER_NAME = System.getenv("NETFLIX_APP");
    private final String AUTO_SCALE_GROUP_NAME = System.getenv("AUTO_SCALE_GROUP");
    private static final String DEFAULT_INSTANCE_DATA_RETRIEVER = "com.netflix.dynomitemanager.sidecore.configSource.AwsInstanceDataRetriever";

    private static String ASG_NAME = System.getenv("ASG_NAME");
    private static String REGION = System.getenv("EC2_REGION");
    
    private final InstanceDataRetriever retriever;
    private final ICredential provider;
    private final IConfigSource configSource;
    
    // Cassandra default configuration
    private static final String DEFAULT_BOOTCLUSTER_NAME = "cass_dyno";
    private static final int DEFAULT_CASSANDRA_THRIFT_PORT = 7102;
    private static final String DEFAULT_CASSANDRA_KEYSPACE_NAME = "dyno_bootstrap";
    private static final String DEFAULT_COMMA_SEPARATED_CASSANDRA_HOSTNAMES = "";
    private static final boolean DEFAULT_IS_EUREKA_HOST_SUPPLIER_ENABLED = true;

     
    @Inject
    public DynomitemanagerConfiguration(ICredential provider, IConfigSource configSource, 
    		InstanceDataRetriever retriever)
    {
    	this.retriever = retriever;
        this.provider = provider;
        this.configSource = configSource;<commit_msg>added default thrift port 9160 and default cassandra being localhost<commit_after>/**
 * Copyright 2016 Netflix, Inc.
 *
 * Licensed 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.
 */
package com.netflix.dynomitemanager.defaultimpl;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.AmazonEC2Client;
import com.amazonaws.services.ec2.model.AvailabilityZone;
import com.amazonaws.services.ec2.model.DescribeAvailabilityZonesResult;
import com.amazonaws.services.ec2.model.DescribeInstancesRequest;
import com.amazonaws.services.ec2.model.DescribeInstancesResult;
import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.ec2.model.Reservation;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.netflix.dynomitemanager.sidecore.IConfigSource;
import com.netflix.dynomitemanager.sidecore.IConfiguration;
import com.netflix.dynomitemanager.sidecore.ICredential;
import com.netflix.dynomitemanager.sidecore.config.InstanceDataRetriever;
import com.netflix.dynomitemanager.sidecore.utils.RetryableCallable;


@Singleton
public class DynomitemanagerConfiguration implements IConfiguration
{
    public static final String DYNOMITEMANAGER_PRE = "florida";
    
    public static final int DYNO_MEMCACHED = 0;
    public static final int DYNO_REDIS     = 1;
    public static final String DYNO_REDIS_CONF_PATH = "/apps/nfredis/conf/redis.conf";
    public static final int DYNO_PORT = 8102;
    public static final int REDIS_PORT = 22122;
    public final static String LOCAL_ADDRESS = "127.0.0.1";

    private static final String CONFIG_DYN_HOME_DIR                    = DYNOMITEMANAGER_PRE + ".dyno.home";
    private static final String CONFIG_DYN_START_SCRIPT                = DYNOMITEMANAGER_PRE + ".dyno.startscript";
    private static final String CONFIG_DYN_STOP_SCRIPT                 = DYNOMITEMANAGER_PRE + ".dyno.stopscript";
    
    private static final String CONFIG_CLUSTER_NAME                    = DYNOMITEMANAGER_PRE + ".dyno.clustername";
    private static final String CONFIG_SEED_PROVIDER_NAME              = DYNOMITEMANAGER_PRE + ".dyno.seed.provider";
    private static final String CONFIG_DYN_LISTENER_PORT_NAME          = DYNOMITEMANAGER_PRE + ".dyno.port";
    private static final String CONFIG_DYN_PEER_PORT_NAME              = DYNOMITEMANAGER_PRE + ".dyno.peer.port";
    private static final String CONFIG_DYN_SECURED_PEER_PORT_NAME      = DYNOMITEMANAGER_PRE + ".dyno.secured.peer.port";
    private static final String CONFIG_RACK_NAME                       = DYNOMITEMANAGER_PRE + ".dyno.rack";
    private static final String CONFIG_USE_ASG_FOR_RACK_NAME           = DYNOMITEMANAGER_PRE + ".dyno.asg.rack";
    private static final String CONFIG_TOKENS_DISTRIBUTION_NAME        = DYNOMITEMANAGER_PRE + ".dyno.tokens.distribution";
    private static final String CONFIG_DYNO_REQ_TIMEOUT_NAME           = DYNOMITEMANAGER_PRE + ".dyno.request.timeout";   //in milliseconds
    private static final String CONFIG_DYNO_GOSSIP_INTERVAL_NAME       = DYNOMITEMANAGER_PRE + ".dyno.gossip.interval"; //in milliseconds
    private static final String CONFIG_DYNO_TOKENS_HASH_NAME           = DYNOMITEMANAGER_PRE + ".dyno.tokens.hash";
    private static final String CONFIG_DYNO_CONNECTIONS_PRECONNECT     = DYNOMITEMANAGER_PRE + ".dyno.connections.preconnect";
    private static final String CONFIG_DYNO_CLUSTER_TYPE               = DYNOMITEMANAGER_PRE + ".dyno.cluster.type";
    private static final String CONFIG_DYNO_IS_MULTI_REGIONED_CLUSTER  = DYNOMITEMANAGER_PRE + ".dyno.multiregion";
    private static final String CONFIG_DYNO_HEALTHCHECK_ENABLE         = DYNOMITEMANAGER_PRE + ".dyno.healthcheck.enable";
    /** The max percentage of system memory to be allocated to the Dynomite fronted data store. */
    private static final String CONFIG_DYNO_STORAGE_MEM_PCT_INT        = DYNOMITEMANAGER_PRE + ".dyno.storage.mem.pct.int";
    
    private static final String CONFIG_DYNO_MBUF_SIZE                  = DYNOMITEMANAGER_PRE + ".dyno.mbuf.size";
    private static final String CONFIG_DYNO_MAX_ALLOC_MSGS			   = DYNOMITEMANAGER_PRE + ".dyno.allocated.messages";	

    private static final String CONFIG_AVAILABILITY_ZONES              = DYNOMITEMANAGER_PRE + ".zones.available";
    private static final String CONFIG_AVAILABILITY_RACKS              = DYNOMITEMANAGER_PRE + ".racks.available";

    private static final String CONFIG_DYN_PROCESS_NAME                = DYNOMITEMANAGER_PRE + ".dyno.processname";
    private static final String CONFIG_YAML_LOCATION                   = DYNOMITEMANAGER_PRE + ".yamlLocation";
    private static final String CONFIG_METADATA_KEYSPACE               = DYNOMITEMANAGER_PRE + ".metadata.keyspace";
    private static final String CONFIG_SECURED_OPTION                  = DYNOMITEMANAGER_PRE + ".secured.option";
    private static final String CONFIG_DYNO_AUTO_EJECT_HOSTS           = DYNOMITEMANAGER_PRE + ".auto.eject.hosts";
   
    // Cassandra Cluster for token management
    private static final String CONFIG_BOOTCLUSTER_NAME                = DYNOMITEMANAGER_PRE + ".bootcluster";
    private static final String CONFIG_CASSANDRA_KEYSPACE_NAME         = DYNOMITEMANAGER_PRE + ".cassandra.keyspace.name";
    private static final String CONFIG_CASSANDRA_THRIFT_PORT           = DYNOMITEMANAGER_PRE + ".cassandra.thrift.port";
    private static final String CONFIG_COMMA_SEPARATED_CASSANDRA_HOSTNAMES = DYNOMITEMANAGER_PRE + ".cassandra.comma.separated.hostnames";

    // Eureka
    private static final String CONFIG_IS_EUREKA_HOST_SUPPLIER_ENABLED = DYNOMITEMANAGER_PRE + ".eureka.host.supplier.enabled";


    // Amazon specific
    private static final String CONFIG_ASG_NAME = DYNOMITEMANAGER_PRE + ".az.asgname";
    private static final String CONFIG_REGION_NAME = DYNOMITEMANAGER_PRE + ".az.region";
    private static final String CONFIG_ACL_GROUP_NAME = DYNOMITEMANAGER_PRE + ".acl.groupname";
    private static final String CONFIG_VPC = DYNOMITEMANAGER_PRE + ".vpc";
    
    /* Dynomite Consistency */
    private static final String CONFIG_DYNO_READ_CONS 	               = DYNOMITEMANAGER_PRE + ".dyno.read.consistency";
    private static final String CONFIG_DYNO_WRITE_CONS                 = DYNOMITEMANAGER_PRE + ".dyno.write.consistency";
    
    // warm up
    private static final String CONFIG_DYNO_WARM_BOOTSTRAP             = DYNOMITEMANAGER_PRE + ".dyno.warm.bootstrap";
    private static final String CONFIG_DYNO_ALLOWABLE_BYTES_SYNC_DIFF  = DYNOMITEMANAGER_PRE + ".dyno.warm.bytes.sync.diff";
    private static final String CONFIG_DYNO_MAX_TIME_BOOTSTRAP		   = DYNOMITEMANAGER_PRE + ".dyno.warm.msec.bootstraptime";
    
    // Backup and Restore
    private static final String CONFIG_BACKUP_ENABLED                  = DYNOMITEMANAGER_PRE + ".dyno.backup.snapshot.enabled";
    private static final String CONFIG_RESTORE_ENABLED                 = DYNOMITEMANAGER_PRE + ".dyno.backup.restore.enabled";
    private static final String CONFIG_AOF_DIR                         = DYNOMITEMANAGER_PRE + ".dyno.backup.aof.directory";
    private static final String CONFIG_BUCKET_NAME                     = DYNOMITEMANAGER_PRE + ".dyno.backup.bucket.name";    
    private static final String CONFIG_S3_BASE_DIR                     = DYNOMITEMANAGER_PRE + ".dyno.backup.s3.base_dir";
    private static final String CONFIG_BACKUP_HOUR                     = DYNOMITEMANAGER_PRE + ".dyno.backup.hour";
    private static final String CONFIG_RESTORE_TIME					   = DYNOMITEMANAGER_PRE + ".dyno.backup.restore.date";
    
    // persistence
    private static final String CONFIG_PERSISTENCE_AOF_ENABLED         = DYNOMITEMANAGER_PRE + ".dyno.persistence.aof.enabled";


    // Defaults 
    private final String DEFAULT_CLUSTER_NAME = "dynomite_demo1";
    private final String DEFAULT_SEED_PROVIDER = "dynomitemanager_provider";
    private final String DEFAULT_DYN_HOME_DIR = "/apps/dynomite";
    private final String DEFAULT_DYN_START_SCRIPT = "/apps/dynomite/bin/launch_dynomite.sh";
    private final String DEFAULT_DYN_STOP_SCRIPT = "/apps/dynomite/bin/kill_dynomite.sh";
    
    private final String DEFAULT_MEMCACHED_START_SCRIPT = "/apps/memcached/bin/memcached";
    private final String DEFAULT_MEMCACHED_STOP_SCRIPT = "/usr/bin/pkill memcached";
    
    private final String DEFAULT_REDIS_START_SCRIPT = "/apps/nfredis/bin/launch_nfredis.sh";
    private final String DEFAULT_REDIS_STOP_SCRIPT = "/apps/nfredis/bin/kill_redis.sh";
    
    
    private List<String> DEFAULT_AVAILABILITY_ZONES = ImmutableList.of();
    private List<String> DEFAULT_AVAILABILITY_RACKS = ImmutableList.of();

    private final String DEFAULT_DYN_PROCESS_NAME = "dynomite";
    private final int DEFAULT_DYN_LISTENER_PORT = 8102;
    private final int DEFAULT_DYN_SECURED_PEER_PORT = 8101;
    private final int DEFAULT_DYN_PEER_PORT = 8101;
    private final int DEFAULT_DYN_MEMCACHED_PORT = 11211;
    private final String DEFAULT_DYN_RACK = "RAC1";
    private final String DEFAULT_TOKENS_DISTRIBUTION = "vnode";
    private final int DEFAULT_DYNO_REQ_TIMEOUT_IN_MILLISEC = 5000;
    private final int DEFAULT_DYNO_GOSSIP_INTERVAL = 10000;
    private final String DEFAULT_DYNO_TOKENS_HASH = "m<PASSWORD>";
    private final int DEFAULT_DYNO_CLUSTER_TYPE = JedisConfiguration.DYNO_REDIS; //redis
    
    
    private final String DEFAULT_METADATA_KEYSPACE = "dyno_bootstrap";
    private final String DEFAULT_SECURED_OPTION    = "datacenter";
    
    // Backup & Restore
    private static final boolean DEFAULT_BACKUP_ENABLED = false;
    private static final boolean DEFAULT_RESTORE_ENABLED = false;
    private static final String DEFAULT_AOF_LOCATION = "/mnt/data/nfredis";
    private static final String DEFAULT_BUCKET_NAME = "us-east-1.dynomite-backup-test";
    private static final String DEFAULT_BUCKET_FOLDER = "backup";
    private static final String DEFAULT_RESTORE_REPOSITORY_TYPE = "s3";
   
    private static final String DEFAULT_RESTORE_SNAPSHOT_NAME = "";
    private static final String DEFAULT_RESTORE_SOURCE_REPO_REGION = "us-east-1";
    private static final String DEFAULT_RESTORE_SOURCE_CLUSTER_NAME = "";
    private static final String DEFAULT_RESTORE_REPOSITORY_NAME = "testrepo";
    private static final String DEFAULT_RESTORE_TIME ="20101010";
    private static final int DEFAULT_BACKUP_HOUR = 12;
    
    // Persistence
    private static final boolean DEFAULT_PERSISTENCE_AOF_ENABLED = false;
   
    private static final Logger logger = LoggerFactory.getLogger(DynomitemanagerConfiguration.class);

    
    private final String CLUSTER_NAME = System.getenv("NETFLIX_APP");
    private final String AUTO_SCALE_GROUP_NAME = System.getenv("AUTO_SCALE_GROUP");
    private static final String DEFAULT_INSTANCE_DATA_RETRIEVER = "com.netflix.dynomitemanager.sidecore.configSource.AwsInstanceDataRetriever";

    private static String ASG_NAME = System.getenv("ASG_NAME");
    private static String REGION = System.getenv("EC2_REGION");
    
    private final InstanceDataRetriever retriever;
    private final ICredential provider;
    private final IConfigSource configSource;
    
    // Cassandra default configuration
    private static final String DEFAULT_BOOTCLUSTER_NAME = "cass_dyno";
    private static final int DEFAULT_CASSANDRA_THRIFT_PORT =  9160; //7102;
    private static final String DEFAULT_CASSANDRA_KEYSPACE_NAME = "dyno_bootstrap";
    private static final String DEFAULT_COMMA_SEPARATED_CASSANDRA_HOSTNAMES = "127.0.0.1";
    private static final boolean DEFAULT_IS_EUREKA_HOST_SUPPLIER_ENABLED = true;
     
    @Inject
    public DynomitemanagerConfiguration(ICredential provider, IConfigSource configSource, 
    		InstanceDataRetriever retriever)
    {
    	this.retriever = retriever;
        this.provider = provider;
        this.configSource = configSource;
{'fraction_non_alphanumeric': 0.06909003370245546, 'fraction_numerical': 0.0071818327716257424, 'mean_word_length': 3.7951135051943057, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3026645', 'n_tokens_mistral': 8017, 'n_tokens_neox': 7696, 'n_words': 1704}