package com.palacesun.engine.spy.option;

import com.palacesun.engine.spy.P6ModuleManager;
import java.util.HashMap;
import java.util.Map;

public class EnvironmentVariables implements P6OptionsSource {
   public Map<String, String> getOptions() {
      Map<String, String> result = new HashMap();

      for(Map.Entry<String, String> entry : System.getenv().entrySet()) {
         String key = (String)entry.getKey();
         if (key.startsWith("p6spy.config.")) {
            result.put(key.substring("p6spy.config.".length()), (String)entry.getValue());
         }
      }

      return result;
   }

   public void postInit(P6ModuleManager p6moduleManager) {
   }

   public void preDestroy(P6ModuleManager p6moduleManager) {
   }
}
