auth

Paddy 2014-12-14 Parent:e98d19699ee9 Child:163ce22fa4c9

102:267483f168b5 Go to Latest

auth/config.go

Require config.Init in Context, add comment. Add comment to config.Init explaining what it is, to make golint happy. Create an ErrConfigNotInitialized error to use when a Config object is used to create a Context before it is initialized. Check for Config initialization in NewContext and throw ErrConfigNotInitialized if the Config hasn't been initialized.

History
     1.1 --- a/config.go	Sun Dec 14 16:23:10 2014 -0500
     1.2 +++ b/config.go	Sun Dec 14 16:49:34 2014 -0500
     1.3 @@ -9,6 +9,8 @@
     1.4  var (
     1.5  	// ErrInvalidLoginURI is returned when a Context is instantiated with a Config object that specifies a LoginURI that can't be parsed as a URL.
     1.6  	ErrInvalidLoginURI = errors.New("invalid login URI")
     1.7 +	// ErrConfigNotInitialized is returned when a Context is instantiated with a Config object that hasn't had its Init function called.
     1.8 +	ErrConfigNotInitialized = errors.New("config not initialized")
     1.9  )
    1.10  
    1.11  // Config holds the configuration values necessary to run a server. A Config
    1.12 @@ -24,6 +26,8 @@
    1.13  	iterations    int
    1.14  }
    1.15  
    1.16 +// Init is a function that preps the Config object to be used for Context creation, setting variables
    1.17 +// that are determined at the beginning of program execution.
    1.18  func (c *Config) Init() error {
    1.19  	scheme, ok := passphraseSchemes[CurPassphraseScheme]
    1.20  	if !ok {