Debug environment variable to CAMLI_DEBUG_CONFIG dump low-level config.

Change-Id: I7e7830112b8f10c5695ad53fd867fb5736925cef
This commit is contained in:
Brad Fitzpatrick 2012-04-08 10:58:34 -07:00
parent 029d66fa9e
commit b07f2f9973
1 changed files with 6 additions and 0 deletions

View File

@ -17,11 +17,13 @@ limitations under the License.
package serverconfig
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"os"
"strconv"
"strings"
"camlistore.org/pkg/auth"
@ -301,6 +303,10 @@ func Load(filename string) (*Config, error) {
"Failed to transform user config file %q into internal handler configuration: %v",
filename, err)
}
if v, _ := strconv.ParseBool(os.Getenv("CAMLI_DEBUG_CONFIG")); v {
jsconf, _ := json.MarshalIndent(conf.Obj, "", " ")
log.Printf("From high-level config, generated low-level config: %s", jsconf)
}
}
return conf, nil