luci-proto-openvpn: create parent directory for config files

To store the configs, the parent directory shall exist first.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
Paul Donald
2026-03-04 18:37:58 +01:00
parent 60b1eac5a4
commit cf718e675c

View File

@@ -899,7 +899,7 @@ const openvpnOptions = [
tab: 'management',
type: form.Value,
name: 'management_external_cert',
datatype: 'path',
datatype: 'file',
label: _('Management cert'),
placeholder: 'certificate-hint'
},
@@ -907,7 +907,7 @@ const openvpnOptions = [
tab: 'management',
type: form.Value,
name: 'management_external_key',
datatype: 'path',
datatype: 'file',
label: _('Management key'),
placeholder: 'nopadding pkcs1'
},
@@ -1867,9 +1867,11 @@ return network.registerProtocol('openvpn', {
};
ovconf.write = function(sid, value) {
const config_name = `/etc/openvpn/${sid}/${sid}_config.cfg`;
fs.exec_direct('/bin/mkdir', ['-p', `/etc/openvpn/${sid}/`]).then(result => {
fs.write(config_name, value).catch(() => {});
uci.set(this.config, sid, 'config', config_name);
});
fs.write(config_name, value).catch(() => {});
uci.set(this.config, sid, 'config', config_name);
return
};
ovconf.rmempty = true;