internal: make internal go version match python version
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -5,16 +5,24 @@ import ( | ||||
| 	"os" | ||||
| ) | ||||
|  | ||||
| func BUILD() string { | ||||
| func BUILD(def string) string { | ||||
| 	build := os.Getenv("GIT_BUILD_HASH") | ||||
| 	if build == "" { | ||||
| 		return "tagged" | ||||
| 		return def | ||||
| 	} | ||||
| 	return build | ||||
| } | ||||
|  | ||||
| func FullVersion() string { | ||||
| 	ver := VERSION | ||||
| 	if b := BUILD(""); b != "" { | ||||
| 		ver = fmt.Sprintf("%s.%s", ver, b) | ||||
| 	} | ||||
| 	return ver | ||||
| } | ||||
|  | ||||
| func OutpostUserAgent() string { | ||||
| 	return fmt.Sprintf("authentik-outpost@%s (build=%s)", VERSION, BUILD()) | ||||
| 	return fmt.Sprintf("authentik-outpost@%s", FullVersion()) | ||||
| } | ||||
|  | ||||
| const VERSION = "2021.12.5" | ||||
|  | ||||
| @ -171,7 +171,7 @@ func (a *APIController) StartBackgorundTasks() error { | ||||
| 		"outpost_type": a.Server.Type(), | ||||
| 		"uuid":         a.instanceUUID.String(), | ||||
| 		"version":      constants.VERSION, | ||||
| 		"build":        constants.BUILD(), | ||||
| 		"build":        constants.BUILD("tagged"), | ||||
| 	}).Set(1) | ||||
| 	go func() { | ||||
| 		a.logger.Debug("Starting WS Handler...") | ||||
|  | ||||
| @ -51,7 +51,7 @@ func (ac *APIController) initWS(akURL url.URL, outpostUUID string) error { | ||||
| 		Instruction: WebsocketInstructionHello, | ||||
| 		Args: map[string]interface{}{ | ||||
| 			"version":   constants.VERSION, | ||||
| 			"buildHash": constants.BUILD(), | ||||
| 			"buildHash": constants.BUILD("tagged"), | ||||
| 			"uuid":      ac.instanceUUID.String(), | ||||
| 		}, | ||||
| 	} | ||||
| @ -151,7 +151,7 @@ func (ac *APIController) startWSHandler() { | ||||
| 					"outpost_type": ac.Server.Type(), | ||||
| 					"uuid":         ac.instanceUUID.String(), | ||||
| 					"version":      constants.VERSION, | ||||
| 					"build":        constants.BUILD(), | ||||
| 					"build":        constants.BUILD("tagged"), | ||||
| 				}).SetToCurrentTime() | ||||
| 			} | ||||
| 		} | ||||
| @ -165,7 +165,7 @@ func (ac *APIController) startWSHealth() { | ||||
| 			Instruction: WebsocketInstructionHello, | ||||
| 			Args: map[string]interface{}{ | ||||
| 				"version":   constants.VERSION, | ||||
| 				"buildHash": constants.BUILD(), | ||||
| 				"buildHash": constants.BUILD("tagged"), | ||||
| 				"uuid":      ac.instanceUUID.String(), | ||||
| 			}, | ||||
| 		} | ||||
| @ -205,7 +205,7 @@ func (ac *APIController) startIntervalUpdater() { | ||||
| 				"outpost_type": ac.Server.Type(), | ||||
| 				"uuid":         ac.instanceUUID.String(), | ||||
| 				"version":      constants.VERSION, | ||||
| 				"build":        constants.BUILD(), | ||||
| 				"build":        constants.BUILD("tagged"), | ||||
| 			}).SetToCurrentTime() | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @ -34,7 +34,7 @@ func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) { | ||||
| 	} else { | ||||
| 		l.Debug("Managed outpost, not setting global log level") | ||||
| 	} | ||||
| 	l.WithField("hash", constants.BUILD()).WithField("version", constants.VERSION).Info("Starting authentik outpost") | ||||
| 	l.WithField("hash", constants.BUILD("tagged")).WithField("version", constants.VERSION).Info("Starting authentik outpost") | ||||
|  | ||||
| 	if globalConfig.ErrorReporting.Enabled { | ||||
| 		dsn := "https://a579bb09306d4f8b8d8847c052d3a1d3@sentry.beryju.org/8" | ||||
|  | ||||
| @ -124,7 +124,7 @@ func (pi *ProviderInstance) GetBaseEntry() *ldap.Entry { | ||||
| 			}, | ||||
| 			{ | ||||
| 				Name:   "vendorVersion", | ||||
| 				Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s (build %s)", constants.VERSION, constants.BUILD())}, | ||||
| 				Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s", constants.FullVersion())}, | ||||
| 			}, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| @ -44,7 +44,7 @@ func (ds *DirectSearcher) SearchBase(req *search.Request, authz bool) (ldap.Serv | ||||
| 					}, | ||||
| 					{ | ||||
| 						Name:   "vendorVersion", | ||||
| 						Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s (build %s)", constants.VERSION, constants.BUILD())}, | ||||
| 						Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s", constants.FullVersion())}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
|  | ||||
| @ -42,7 +42,7 @@ Besides these user-specific headers, some application specific headers are also | ||||
|  | ||||
|     The authentik application's slug. | ||||
|  | ||||
| - X-authentik-meta-version: `authentik-outpost@1.2.3 (build=tagged)` | ||||
| - X-authentik-meta-version: `authentik-outpost@1.2.3` | ||||
|  | ||||
|     The authentik outpost's version. | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer