mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-13 19:54:59 +00:00
fix:console commands for Secrets Management Modified
This commit is contained in:
@@ -39,7 +39,10 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
Name = dc.Name;
|
Name = dc.Name;
|
||||||
Group = dc.Group;
|
Group = dc.Group;
|
||||||
Type = dc.Type;
|
Type = dc.Type;
|
||||||
Properties = JToken.FromObject(dc.Properties);
|
|
||||||
|
Properties = JToken.Parse(dc.Properties.ToString());
|
||||||
|
|
||||||
|
//Properties = JToken.FromObject(dc.Properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceConfig() {}
|
public DeviceConfig() {}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace PepperDash.Essentials.Core.Devices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by the extending class to allow for any custom actions to be taken (tell the ConfigWriter to write config, etc)
|
/// Used by the extending class to allow for any custom actions to be taken (tell the ConfigWriter to write config, etc)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Config"></param>
|
/// <param name="config"></param>
|
||||||
protected virtual void CustomSetConfig(DeviceConfig config)
|
protected virtual void CustomSetConfig(DeviceConfig config)
|
||||||
{
|
{
|
||||||
ConfigWriter.UpdateDeviceConfig(config);
|
ConfigWriter.UpdateDeviceConfig(config);
|
||||||
|
|||||||
@@ -36,21 +36,22 @@ namespace PepperDash.Essentials.Core
|
|||||||
public bool SetSecret(string key, object value)
|
public bool SetSecret(string key, object value)
|
||||||
{
|
{
|
||||||
var secret = value as string;
|
var secret = value as string;
|
||||||
|
CrestronDataStore.CDS_ERROR returnCode;
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(secret))
|
if (String.IsNullOrEmpty(secret))
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Unable to set secret for {0}:{1} - value is empty.", Key, key);
|
returnCode = CrestronDataStoreStatic.clearLocal(key);
|
||||||
return false;
|
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS) return true;
|
||||||
}
|
}
|
||||||
var setErrorCode = CrestronDataStoreStatic.SetLocalStringValue(key, secret);
|
|
||||||
switch (setErrorCode)
|
else
|
||||||
{
|
{
|
||||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
returnCode = CrestronDataStoreStatic.SetLocalStringValue(key, secret);
|
||||||
Debug.Console(1, this,"Secret Successfully Set for {0}:{1}", Key, key);
|
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS) return true;
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, setErrorCode.ToString());
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, returnCode.ToString());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user