func (c *SecretsManager) LoadSecretKey() string {
	// Case 1: Environment Variable
	currentSecretKey := ""
	if envSecretKey := strings.TrimSpace(os.Getenv("KSM_TOKEN")); envSecretKey != "" {
		currentSecretKey = envSecretKey
		klog.Info("Secret key found in environment variable")
	}

	// Case 2: Code
	if currentSecretKey == "" && strings.TrimSpace(c.Token) != "" {
		currentSecretKey = strings.TrimSpace(c.Token)
		klog.Info("Secret key found in code")
	}

	// Case 3: Config storage
	if currentSecretKey == "" {
		if configSecretKey := strings.TrimSpace(c.Config.Get(KEY_CLIENT_KEY)); configSecretKey != "" {
			currentSecretKey = configSecretKey
			klog.Info("Secret key found in configuration file")
		}
	}

	return strings.TrimSpace(currentSecretKey)
}
// Returns client_id from the environment variable, config file, or in the code
Returns client_id from the environment variable, config file, or in the code
// Returns client_id from the environment variable config file or in the code
func (c *SecretsManager) LoadSecretKey() string {
	currentSecretKey := ""
	if envSecretKey := strings.TrimSpace(os.Getenv("KSM_TOKEN")); envSecretKey != "" {
		currentSecretKey = envSecretKey
		klog.Info("Secret key found in environment variable")
	}
	if currentSecretKey == "" && strings.TrimSpace(c.Token) != "" {
		currentSecretKey = strings.TrimSpace(c.Token)
		klog.Info("Secret key found in code")
	}
	if currentSecretKey == "" {
		if configSecretKey := strings.TrimSpace(c.Config.Get(KEY_CLIENT_KEY)); configSecretKey != "" {
			currentSecretKey = configSecretKey
			klog.Info("Secret key found in configuration file")
		}
	}
	return strings.TrimSpace(currentSecretKey)
}
func ( c * SecretsManager ) LoadSecretKey ( ) string { currentSecretKey := " " if envSecretKey := strings . TrimSpace ( os . Getenv ( " " ) ) ; envSecretKey != " " { currentSecretKey = envSecretKey klog . Info ( " " ) } if currentSecretKey == " " && strings . TrimSpace ( c . Token ) != " " { currentSecretKey = strings . TrimSpace ( c . Token ) klog . Info ( " " ) } if currentSecretKey == " " { if configSecretKey := strings . TrimSpace ( c . Config . Get ( KEY_CLIENT_KEY ) ) ; configSecretKey != " " { currentSecretKey = configSecretKey klog . Info ( " " ) } } return strings . TrimSpace ( currentSecretKey ) }
Returns client_id from the environment variable, config file, or in the code
Returns client_id from the environment variable config file or in the code
// Case 1: Environment Variable // Case 2: Code // Case 3: Config storage