2121use OCP \AppFramework \Http \Attribute \PasswordConfirmationRequired ;
2222use OCP \AppFramework \Http \JSONResponse ;
2323use OCP \AppFramework \Http \Response ;
24- use OCP \IConfig ;
24+ use OCP \IAppConfig ;
2525use OCP \IL10N ;
2626use OCP \IRequest ;
2727use OCP \Security \ICrypto ;
@@ -33,7 +33,7 @@ class DaemonConfigController extends ApiController {
3333
3434 public function __construct (
3535 IRequest $ request ,
36- private readonly IConfig $ config ,
36+ private readonly IAppConfig $ appConfig ,
3737 private readonly DaemonConfigService $ daemonConfigService ,
3838 private readonly DockerActions $ dockerActions ,
3939 private readonly AppAPIService $ service ,
@@ -47,15 +47,15 @@ public function __construct(
4747 public function getAllDaemonConfigs (): Response {
4848 return new JSONResponse ([
4949 'daemons ' => $ this ->daemonConfigService ->getDaemonConfigsWithAppsCount (),
50- 'default_daemon_config ' => $ this ->config -> getAppValue (Application::APP_ID , 'default_daemon_config ' ),
50+ 'default_daemon_config ' => $ this ->appConfig -> getValueString (Application::APP_ID , 'default_daemon_config ' , lazy: true ),
5151 ]);
5252 }
5353
5454 #[PasswordConfirmationRequired]
5555 public function registerDaemonConfig (array $ daemonConfigParams , bool $ defaultDaemon = false ): Response {
5656 $ daemonConfig = $ this ->daemonConfigService ->registerDaemonConfig ($ daemonConfigParams );
5757 if ($ daemonConfig !== null && $ defaultDaemon ) {
58- $ this ->config -> setAppValue (Application::APP_ID , 'default_daemon_config ' , $ daemonConfig ->getName ());
58+ $ this ->appConfig -> setValueString (Application::APP_ID , 'default_daemon_config ' , $ daemonConfig ->getName (), lazy: true );
5959 }
6060 return new JSONResponse ([
6161 'success ' => $ daemonConfig !== null ,
@@ -107,10 +107,10 @@ public function updateDaemonConfig(string $name, array $daemonConfigParams): Res
107107 #[PasswordConfirmationRequired]
108108 public function unregisterDaemonConfig (string $ name ): Response {
109109 $ daemonConfig = $ this ->daemonConfigService ->getDaemonConfigByName ($ name );
110- $ defaultDaemonConfig = $ this ->config -> getAppValue (Application::APP_ID , 'default_daemon_config ' , '' );
110+ $ defaultDaemonConfig = $ this ->appConfig -> getValueString (Application::APP_ID , 'default_daemon_config ' , '' , lazy: true );
111111 $ this ->service ->removeExAppsByDaemonConfigName ($ daemonConfig );
112112 if ($ daemonConfig ->getName () === $ defaultDaemonConfig ) {
113- $ this ->config -> deleteAppValue (Application::APP_ID , 'default_daemon_config ' );
113+ $ this ->appConfig -> deleteKey (Application::APP_ID , 'default_daemon_config ' );
114114 }
115115 $ daemonConfig = $ this ->daemonConfigService ->unregisterDaemonConfig ($ daemonConfig );
116116 return new JSONResponse ([
0 commit comments