Created
March 28, 2022 13:31
-
-
Save rkpattnaik780/e04e3f4ad9010d974b9dbe3e0df0c1af to your computer and use it in GitHub Desktop.
GetCurrentContext
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GetCurrent_Context returns the name of the currently selected context | |
func GetCurrent_Context(svcContext *servicecontext.Context, localizer localize.Localizer) (*servicecontext.ServiceConfig, error) { | |
if svcContext.CurrentContext == "" { | |
return nil, localizer.MustLocalizeError("context.common.error.notSet") | |
} | |
currCtx, ok := svcContext.Contexts[svcContext.CurrentContext] | |
if !ok { | |
return nil, localizer.MustLocalizeError("context.common.error.context.notFound", localize.NewEntry("Name", svcContext.CurrentContext)) | |
} | |
return &currCtx, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment