Пример #1
0
// Init for this module does nothing.
func (j *Jira) Init(b core.Bot) error {
	if _, hasEntry := b.Configuration()[ConfigJiraCredentials]; !hasEntry {
		envCredentials := os.Getenv(EnvironmentJiraCredentials)
		if len(envCredentials) != 0 {
			b.Configuration()[ConfigJiraCredentials] = envCredentials
		} else {
			b.Logf("No `%s` provided, module `%s` cannot load.", EnvironmentJiraHost, ModuleJira)
			return nil
		}
	}

	if _, hasEntry := b.Configuration()[ConfigJiraHost]; !hasEntry {
		envHost := os.Getenv(EnvironmentJiraHost)
		if len(envHost) != 0 {
			b.Configuration()[ConfigJiraHost] = envHost
		} else {
			b.Logf("No `%s` provided, module `%s` cannot load.", EnvironmentJiraHost, ModuleJira)
			return nil
		}
	}

	return nil
}