public void doInitialize()

in src/AWSSecretsManagerKeyStrategy.java [124:159]


  public void doInitialize() throws ComponentInitializationException {
    log.debug("doInitialize()");
    try {
      try {
	//secretId = StringSupport.trimOrNull(System.getenv("SEALER_KEY_SECRET_ID"));
	Constraint.isNotNull(secretId, "Secret ID cannot be null");
      } catch (final ConstraintViolationException e) {
	throw new ComponentInitializationException(e);
      }

      updateDefaultKey();
    
    } catch (final KeyException e) {
      log.error("Error loading default key from secret ID '{}' {}", secretId, e.getMessage());
      throw new ComponentInitializationException("Exception loading the default key", e);
    }

    if (!updateInterval.isZero()) {
      updateTask = new TimerTask() {
	@Override
	public void run() {
	  try {
	    updateDefaultKey();
	  } catch (final KeyException e) {
		
	  }
	}
      };
      if (updateTaskTimer == null) {
	internalTaskTimer = new Timer(TimerSupport.getTimerName(this), true);
      } else {
	internalTaskTimer = updateTaskTimer;
      }
      internalTaskTimer.schedule(updateTask, updateInterval.toMillis(), updateInterval.toMillis());
    }
  }