Add switchContext function to context.go

This commit is contained in:
Simon Aquino
2014-08-16 11:36:15 +00:00
parent df06dc356b
commit 1f2ddca32b
+8
View File
@@ -40,6 +40,7 @@ type AptlyContext struct {
} }
var context *AptlyContext var context *AptlyContext
var savedContext *AptlyContext
// Check interface // Check interface
var _ aptly.PublishedStorageProvider = &AptlyContext{} var _ aptly.PublishedStorageProvider = &AptlyContext{}
@@ -60,6 +61,13 @@ func Fatal(err error) {
panic(&FatalError{ReturnCode: returnCode, Message: err.Error()}) panic(&FatalError{ReturnCode: returnCode, Message: err.Error()})
} }
func switchContext() {
savedContext = context
context = savedContext
}
// Config loads and returns current configuration // Config loads and returns current configuration
func (context *AptlyContext) Config() *utils.ConfigStructure { func (context *AptlyContext) Config() *utils.ConfigStructure {
if !context.configLoaded { if !context.configLoaded {