static void Main(string[] args)
        {
            try
            {
                var pAuthorise = Convert.ToInt32(args[0]);

                if (0 >= pAuthorise || pAuthorise > 100)
                {
                    throw new ArgumentException(nameof(pAuthorise));
                }

                var seed = Convert.ToInt32(args[1]);

                var config = AppSettingsFromJsonFiles.GetConfigurationRoot();
                using var dbContextProvider = new DbContextProvider <ExposureContentDbContext>(
                          () => new ExposureContentDbContext(new PostGresDbContextOptionsBuilder(new StandardEfDbConfig(config, "MSS")).Build())
                          );

                var authorise = new GenerateAuthorisations(dbContextProvider, new WorkflowDbAuthoriseCommand(dbContextProvider));
                authorise.Execute(pAuthorise, new Random(seed));
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            try
            {
                var config = AppSettingsFromJsonFiles.GetConfigurationRoot();
                using var dbContextProvider = new DbContextProvider <ExposureContentDbContext>(
                          () => new ExposureContentDbContext(new PostGresDbContextOptionsBuilder(new StandardEfDbConfig(config, "Content")).Build())
                          );


                var WorkflowCount = Convert.ToInt32(args[0]);
                if (WorkflowCount < 1)
                {
                    throw new ArgumentOutOfRangeException(nameof(WorkflowCount));
                }

                var randomSeed = Convert.ToInt32(args[1]);

                var r  = new Random(randomSeed); //Don't need the crypto version.
                var c1 = new GenerateAgWorkflows(dbContextProvider);
                c1.Execute(WorkflowCount, x => r.Next(x), x => r.NextBytes(x));
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            try
            {
                var config = AppSettingsFromJsonFiles.GetConfigurationRoot();
                using var dbContextProvider = new DbContextProvider <ExposureContentDbContext>(
                          () => new ExposureContentDbContext(new PostGresDbContextOptionsBuilder(new StandardEfDbConfig(config, "Content")).Build())
                          );

                var dpProvision = new CreateDatabaseAndCollections(dbContextProvider, new Sha256PublishingIdCreator(new HardCodedExposureKeySetSigning()));
                dpProvision.Execute().GetAwaiter().GetResult();
                Console.WriteLine("Completed.");
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            try
            {
                var standardUtcDateTimeProvider = new StandardUtcDateTimeProvider();
                var config = AppSettingsFromJsonFiles.GetConfigurationRoot();

                using var inputContext = new DbContextProvider <WorkflowDbContext>(
                          () => new WorkflowDbContext(new PostGresDbContextOptionsBuilder(new StandardEfDbConfig(config, "Input")).Build())
                          );

                var jobConfigBuilder = new PostGresDbContextOptionsBuilder(new StandardEfDbConfig(config, "Job"));
                using var jobContext = new DbContextProvider <ExposureKeySetsBatchJobDbContext>(
                          () => new ExposureKeySetsBatchJobDbContext(jobConfigBuilder.Build())
                          );

                using var outputContext = new DbContextProvider <ExposureContentDbContext>(
                          () => new ExposureContentDbContext(new PostGresDbContextOptionsBuilder(new StandardEfDbConfig(config, "Output")).Build())
                          );

                using var bb = new ExposureKeySetBatchJob(
                          new DbTekSource(inputContext),
                          jobConfigBuilder,
                          standardUtcDateTimeProvider,
                          new ExposureKeySetDbWriter(outputContext, new Sha256PublishingIdCreator(new HardCodedExposureKeySetSigning())),
                          new HardCodedAgConfig(),
                          new JsonContentExposureKeySetFormatter(),
                          new ExposureKeySetBuilderV1(
                              new HsmExposureKeySetHeaderInfoConfig(config),
                              new HardCodedExposureKeySetSigning(), standardUtcDateTimeProvider, new GeneratedProtobufContentFormatter())
                          , new ExposureKeySetBatchJobConfig(config)
                          );

                bb.Execute().GetAwaiter().GetResult();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }