Exemplo n.º 1
0
 public static void Configure(UriDalConfig config)
 {
     publicKeyName     = config.PublicKey;
     privateKeyName    = config.PrivateKey;
     vector            = config.Vector;
     EncryptionEnabled = config.EncryptionEnabled;
 }
Exemplo n.º 2
0
    public Dictionary <string, string> Configure(ISynapseDalConfig conifg)
    {
        if (conifg != null && conifg.Config != null)
        {
            string       s    = YamlHelpers.Serialize(conifg.Config);
            UriDalConfig fsds = YamlHelpers.Deserialize <UriDalConfig>(s);

            _planPath = fsds.PlanFolderPath;
            _histPath = fsds.HistoryFolderPath;
            _splxPath = fsds.Security.FilePath;

            EnsurePaths();

            ProcessPlansOnSingleton   = fsds.ProcessPlansOnSingleton;
            ProcessActionsOnSingleton = fsds.ProcessActionsOnSingleton;

            LoadSuplex();

            if (fsds.CloudPlatform == CloudPlatform.Azure)
            {
                AzureUriDalConfig azureConfig = YamlHelpers.Deserialize <AzureUriDalConfig>(s);
                cloudUriHandler = new AzureCloudUriHandler(azureConfig);
            }
            else
            {
                AWSUriDalConfig awsConfig = YamlHelpers.Deserialize <AWSUriDalConfig>(s);
                cloudUriHandler = new AWSCloudUriHandler(awsConfig);
            }
            EncryptionHelper.Configure(fsds);

            if (_splxDal == null && fsds.Security.IsRequired)
            {
                throw new Exception($"Security is required.  Could not load security file: {_splxPath}.");
            }

            if (_splxDal != null)
            {
                _splxDal.LdapRoot = conifg.LdapRoot;
                _splxDal.GlobalExternalGroupsCsv = fsds.Security.GlobalExternalGroupsCsv;
            }
        }
        else
        {
            ConfigureDefaults();
        }

        Dictionary <string, string> props = new Dictionary <string, string>();
        string name = nameof(UriDal);

        props.Add(name, CurrentPath);
        props.Add($"{name} Plan path", _planPath);
        props.Add($"{name} History path", _histPath);
        props.Add($"{name} Security path", _splxPath);
        return(props);
    }