20
20
*/
21
21
class ConfigOptionsList implements ConfigOptionsListInterface
22
22
{
23
+ /**
24
+ * Input key for the option
25
+ */
26
+ private const INPUT_KEY_SALT = 'id_salt ' ;
27
+
28
+ /**
29
+ * Path to the value in the deployment config
30
+ */
31
+ private const CONFIG_PATH_SALT = 'cache/graphql/id_salt ' ;
32
+
23
33
/**
24
34
* @var Random
25
35
*/
26
36
private $ random ;
27
37
28
38
/**
29
- * Deployment configuration
30
- *
31
39
* @var DeploymentConfig
32
40
*/
33
41
private $ deploymentConfig ;
@@ -51,9 +59,9 @@ public function getOptions(): array
51
59
{
52
60
return [
53
61
new TextConfigOption (
54
- ConfigOptionsListConstants ::INPUT_KEY_SALT ,
62
+ self ::INPUT_KEY_SALT ,
55
63
TextConfigOption::FRONTEND_WIZARD_TEXT ,
56
- ConfigOptionsListConstants ::CONFIG_PATH_SALT ,
64
+ self ::CONFIG_PATH_SALT ,
57
65
'GraphQl Salt '
58
66
),
59
67
];
@@ -65,17 +73,17 @@ public function getOptions(): array
65
73
*/
66
74
public function createConfig (array $ data , DeploymentConfig $ deploymentConfig )
67
75
{
68
- $ currentIdSalt = $ this ->deploymentConfig ->get (ConfigOptionsListConstants ::CONFIG_PATH_SALT );
76
+ $ currentIdSalt = $ this ->deploymentConfig ->get (self ::CONFIG_PATH_SALT );
69
77
70
78
$ configData = new ConfigData (ConfigFilePool::APP_ENV );
71
79
72
80
// Use given salt if set, else use current
73
- $ id_salt = $ data [ConfigOptionsListConstants ::INPUT_KEY_SALT ] ?? $ currentIdSalt ;
81
+ $ id_salt = $ data [self ::INPUT_KEY_SALT ] ?? $ currentIdSalt ;
74
82
75
83
// If there is no salt given or currently set, generate a new one
76
84
$ id_salt = $ id_salt ?? $ this ->random ->getRandomString (ConfigOptionsListConstants::STORE_KEY_RANDOM_STRING_SIZE );
77
85
78
- $ configData ->set (ConfigOptionsListConstants ::CONFIG_PATH_SALT , $ id_salt );
86
+ $ configData ->set (self ::CONFIG_PATH_SALT , $ id_salt );
79
87
80
88
return [$ configData ];
81
89
}
0 commit comments