random = $random; $this->deploymentConfig = $deploymentConfig; } /** * @inheritDoc */ public function getOptions(): array { return [ new TextConfigOption( self::INPUT_KEY_SALT, TextConfigOption::FRONTEND_WIZARD_TEXT, self::CONFIG_PATH_SALT, 'GraphQl Salt' ), ]; } /** * @inheritdoc * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function createConfig(array $data, DeploymentConfig $deploymentConfig) { $currentIdSalt = $this->deploymentConfig->get(self::CONFIG_PATH_SALT); $configData = new ConfigData(ConfigFilePool::APP_ENV); // Use given salt if set, else use current $id_salt = $data[self::INPUT_KEY_SALT] ?? $currentIdSalt; // If there is no salt given or currently set, generate a new one $id_salt = $id_salt ?? $this->random->getRandomString(ConfigOptionsListConstants::STORE_KEY_RANDOM_STRING_SIZE); $configData->set(self::CONFIG_PATH_SALT, $id_salt); return [$configData]; } /** * @inheritdoc */ public function validate(array $options, DeploymentConfig $deploymentConfig) { return []; } }