protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseNpgsql(EnvUtils.Get("CITUS_CONNECTION_STRING")); } }
public MetadataWriteRepository() { var accountEndpoint = EnvUtils.Get("COSMOS_DB_ACCOUNT_ENDPOINT"); var authKey = EnvUtils.Get("COSMOS_DB_AUTH_KEY"); var client = new CosmosClient(accountEndpoint, authKey, new CosmosClientOptions { SerializerOptions = new CosmosSerializationOptions { PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase, } }); _container = client.GetContainer("sensors", "metadata"); }
static async Task Main(string[] args) { var hostBuilder = new HostBuilder() .ConfigureServices((context, collection) => { var accountEndpoint = EnvUtils.Get("COSMOS_DB_ACCOUNT_ENDPOINT"); var key = EnvUtils.Get("COSMOS_DB_AUTH_KEY"); CosmosClient cosmosClient = new CosmosClientBuilder(accountEndpoint, key) .WithApplicationRegion(Regions.EastUS) .WithApplicationName("Telemetry Events Processor Container") .Build(); collection.AddSingleton(cosmosClient); collection.AddHostedService <ChangeFeedProcessorHostedService>(); }); await hostBuilder.RunConsoleAsync(); }
public WriteService() { _client = new HttpClient(); _writeServiceUrl = EnvUtils.Get("METADATA_WRITE_SERVICE_URL"); }
static void Main(string[] arguments) { ICommandLineParser commandLineParser = new PosixParser(); CommandLine commandLine = commandLineParser.Parse(Options, arguments); int port = SocketOpenOfficeConnection.DefaultPort; if (commandLine.HasOption(OptionPort.Opt)) { port = Convert.ToInt32(commandLine.GetOptionValue(OptionPort.Opt)); } String outputFormat = null; if (commandLine.HasOption(OptionOutputFormat.Opt)) { outputFormat = commandLine.GetOptionValue(OptionOutputFormat.Opt); } bool verbose = commandLine.HasOption(OptionVerbose.Opt); IDocumentFormatRegistry registry = new DefaultDocumentFormatRegistry(); String[] fileNames = commandLine.Args; if ((outputFormat == null && fileNames.Length != 2) || fileNames.Length < 1) { String syntax = "Convert [options] input-file output-file; or\n" + "[options] -f output-format input-file [input-file...]"; HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.PrintHelp(syntax, Options); Environment.Exit(ExitCodeTooFewArgs); } IOpenOfficeConnection connection = new SocketOpenOfficeConnection(port); OfficeInfo oo = EnvUtils.Get(); if (oo.Kind == OfficeKind.Unknown) { Console.Out.WriteLine("please setup OpenOffice or LibreOffice!"); return; } try { if (verbose) { Console.Out.WriteLine("-- connecting to OpenOffice.org on port " + port); } connection.Connect(); } catch (Exception) { string CmdArguments = string.Format("-headless -accept=\"socket,host={0},port={1};urp;\" -nofirststartwizard", SocketOpenOfficeConnection.DefaultHost, SocketOpenOfficeConnection.DefaultPort); if (!EnvUtils.RunCmd(oo.OfficeUnoPath, "soffice", CmdArguments)) { Console.Error.WriteLine("ERROR: connection failed. Please make sure OpenOffice.org is running and listening on port " + port + "."); Environment.Exit(ExitCodeConnectionFailed); } } try { IDocumentConverter converter = new OpenOfficeDocumentConverter(connection, registry); if (outputFormat == null) { FileInfo inputFile = new FileInfo(fileNames[0]); FileInfo outputFile = new FileInfo(fileNames[1]); ConvertOne(converter, inputFile, outputFile, verbose); } else { foreach (var t in fileNames) { var inputFile = new FileInfo(t); var outputFile = new FileInfo(inputFile.FullName.Remove(inputFile.FullName.LastIndexOf(".", StringComparison.Ordinal)) + "." + outputFormat); ConvertOne(converter, inputFile, outputFile, verbose); } } } finally { if (verbose) { Console.Out.WriteLine("-- disconnecting"); } connection.Disconnect(); } }
public QueryService() { _client = new HttpClient(); _queryServiceUrl = EnvUtils.Get("QUERY_SERVICE_URL"); }