static void Main(string[] args) { WritePassedArgsToLog(args); var configuration = GetConfiguration() ?? new Configuration { Port = DEFAULT_PORT }; /* * sample configuration: * * { * "Path": "c:\\developer\\sergueik\\external\\angular-master", * "Port": 8080 * } * */ StaticContentController.SiteRootPath = PathNormalizer.NormalizePath(configuration.Path); var port = configuration.Port; Logger.InfoFormat("Starting...\r\nPort = {0}\r\nPath = {1}", port, StaticContentController.SiteRootPath); var serviceName = Assembly.GetEntryAssembly().GetName().Name + "_Port_" + port; var microService = new MicroService(port, serviceName, serviceName); microService.Run(args); }
public static MicroService WithApplicationHost(this MicroService microservice, Action <ApplicationHostConfiguration> configurator) { var config = new ApplicationHostConfiguration(); configurator(config); microservice.Configuration.Modules.Add(new ApplicationHostExtensionsModule(config)); return(microservice); }
public IEnumerable <ReportModel> GetAllReports() { var report = MicroService.GetReports(startDate: DateTime.Now, endDate: DateTime.Now.AddMonths(2), target: 83567); _reports = report.ToList(); return(report); }
/// <summary> /// Mains the specified arguments. /// </summary> /// <param name="args">The arguments.</param> static void Main(string[] args) { var port = int.Parse(ProductConfiguration.Port); var serviceDisplayName = ProductConfiguration.ProductServiceDisplayName; var serviceName = ProductConfiguration.ProductServiceName; var microService = new MicroService(port, serviceDisplayName, serviceName, configure => GetConfig(configure)); microService.Run(args); }
public static MicroService WithGateway(this MicroService microservice, Action <GatewayConfiguration> configurator = null) { var configuration = new GatewayConfiguration(); configurator?.Invoke(configuration); microservice.Configuration.Modules.Add(new GatewayExtensionsModule(configuration)); return(microservice); }
static int Main(string[] args) { return(MicroService .Configure(config => { config.ServiceName = "Cosella.Example"; config.ServiceDisplayName = "Cosella Example Service"; }) .Run()); }
static void Main(string[] args) { Test(); // default port is 8080, if you want to change the port, change the port value. // Please note that if you want this to run on port 80, you should run the program as administrator. var microService = new MicroService(port: 8080, serviceDisplayName: "[Data Production/API micro-service for QA team]"); microService.Run(args); }
private static MicroService Init(MicroService microservice, Action <AuthenticationConfiguration> configurator, Type authenticatorType, Type tokenHandlerType) { var configuration = new AuthenticationConfiguration(); configurator?.Invoke(configuration); microservice.Configuration.Modules.Add(new AuthenticationExtensionsModule(configuration, authenticatorType, tokenHandlerType)); microservice.Configuration.Middleware.Add(UseAuthentication); return(microservice); }
static void Main(string[] args) { try { var microService = new MicroService(1235); microService.Run(args); } catch (Exception ex) { ex.ToString(); } }
/// <summary> /// Mains the specified arguments. /// </summary> /// <param name="args">The arguments.</param> static void Main(string[] args) { WritePassedArgsToLog(args); arguments = args; var configuration = GetConfiguration() ?? new Configuration { Port = DEFAULT_PORT }; if (configuration.doDisableLogFiles) { HostMe.Logger.rollingFileAppender.Close(); } StaticContentController.SiteRootPath = PathNormalizer.NormalizePath(configuration.Path); var port = configuration.Port; if (configuration.doAutoSelectUnusedPort) { port = GetOpenPort(port); } Logger.InfoFormat("Starting...\r\nPort = {0}\r\nPath = {1}", port, StaticContentController.SiteRootPath); var serviceName = Assembly.GetEntryAssembly().GetName().Name + "_Port_" + port; service = new MicroService(port, serviceName, serviceName); Thread secondThread = new Thread(runService); secondThread.Start(); if (configuration.doAutoOpenDefaultBrowser) { tryOpenUrl("http://localhost:" + port); } }
static void Main(string[] args) { WritePassedArgsToLog(args); var configuration = GetConfiguration() ?? new Configuration { Port = DEFAULT_PORT }; StaticContentController.SiteRootPath = PathNormalizer.NormalizePath(configuration.Path); var port = configuration.Port; Logger.InfoFormat("Starting...\r\nPort = {0}\r\nPath = {1}", port, StaticContentController.SiteRootPath); var serviceName = Assembly.GetEntryAssembly().GetName().Name + "_Port_" + port; var microService = new MicroService(port, serviceName, serviceName); microService.Run(args); }
private static int Main(string[] args) { return(MicroService // Create the service .Configure(config => { // Gateway service basic config config.ServiceName = "Gateway"; config.ServiceDisplayName = "Cosella Gateway"; config.ServiceDescription = "API gateway for Cosella framework"; // Configre the API location config.RestApiPort = 5000; // Turn off service discovery config.DisableRegistration = true; config.DisableServiceDiscovery = true; }) // Use default gateway (No configuration available yet) .WithGateway(config => { // We're not interested in the gateway endpoint or any service managment facility config.DisableServiceManager = true; }) // Use the built in simple authenticator (inject your IAuthenticator and ITokenHandler here) .WithAuthentication <Authenticator>(config => { // Turning on the Simple Token controller will give you a token issuing endpoint config.EnableSimpleTokenController = true; // Turning on the Simple User manager will give you a simple user management endpoint config.EnableSimpleUserManager = true; // As the Simple User manager endpoints are permissions you need to set up some default users config.SimpleUserManagerSeedUsers = new List <User>() { // The "User:Admin" and "User" roles are necessary to administer users new User("admin", "admin", new [] { "user:admin", "user" }) }; }) .Run()); }
private List <MicroService> BuildService(AddressTableConfiguration configuration) { var services = new List <MicroService>(); if (configuration.Entries != null && configuration.Entries.Any()) { foreach (var entry in configuration.Entries) { var service = new MicroService() { Id = entry.Id, Service = configuration.Service, Address = entry.Address, Port = entry.Port, Tags = entry.Tags }; services.Add(service); } } return(services); }
/// <summary> /// Creates a cluster /// </summary> /// <param name="cluster">the cluster definition to insert into the database</param> /// <param name="OwnedBy">the ogranisation that has creted this cluster/the owner of the cluster</param> /// <returns>The created cluster</returns> public static Cluster Create(Monosoft.Auth.DTO.Cluster cluster, Guid OwnedBy) { // TODO: revisionslog, hvem har opdateret (fra hvad, til hvad og hvornår) Cluster dbcluster = new Cluster(); dbcluster.Name = cluster.Name; dbcluster.OwnedByOrganisationId = OwnedBy; dbcluster.Endpoints = cluster.Endpoints.Select(p => p.IP).ToArray(); DataContext.Instance.Clusters.Add(dbcluster); if (cluster.Servers != null) { foreach (var server in cluster.Servers) { Server dbserver = new Server(); dbserver.Cluster = dbcluster; dbserver.IP = server.IP; dbserver.Name = server.Name; DataContext.Instance.Servers.Add(dbserver); if (server.Services != null) { foreach (var service in server.Services) { MicroService dbservice = new MicroService(); dbservice.Name = service.Name; dbservice.Version = service.Version; dbservice.Server = dbserver; DataContext.Instance.MicroServices.Add(dbservice); } } } } DataContext.Instance.SaveChanges(); return(dbcluster); }
public List <DayModel> GetOperationDays() { return(MicroService.GetOperationDays(DateTime.Now, DateTime.Now.AddMonths(2))); }
public void Post([FromBody] MicroService service) { serviceList.Add(service); }
public static MicroService WithAuthentication <TAuthenticator, TTokenHandler>(this MicroService microservice, Action <AuthenticationConfiguration> configurator = null) where TAuthenticator : IAuthenticator where TTokenHandler : ITokenHandler { return(Init(microservice, configurator, typeof(TAuthenticator), typeof(TTokenHandler))); }
public static MicroService WithAuthentication(this MicroService microservice, Action <AuthenticationConfiguration> configurator = null) { return(Init(microservice, configurator, null, null)); }
static void Main(string[] args) { var microService = new MicroService(); microService.Run(args); }
public static void Main(string[] args) { var microService = new MicroService(port: 14001); microService.Run(args); }
public static int Main(string[] args) => MicroService.Run <Startup>(args);
/// <summary> /// Update a cluster /// </summary> /// <param name="cluster">the cluster definition to updated in the database</param> /// <param name="callingOrganisation">the calling organisation - which must be the owner to update</param> /// <returns>The updated cluster</returns> public static Cluster Update(Monosoft.Auth.DTO.Cluster cluster, Guid callingOrganisation) { // TODO: revisionslog, hvem har opdateret (fra hvad, til hvad og hvornår) var dbcluster = DataContext.Instance.Clusters.Where(p => p.ClusterId == cluster.ClusterId && p.OwnedByOrganisationId == callingOrganisation).FirstOrDefault(); if (dbcluster != null) { dbcluster.Name = cluster.Name; dbcluster.Endpoints = cluster.Endpoints.Select(p => p.IP).ToArray(); var removedServers = dbcluster.Servers.Where(p => cluster.Servers.Select(x => x.Id).Contains(p.Id) == false).ToList(); var updatedServers = dbcluster.Servers.Where(p => cluster.Servers.Select(x => x.Id).Contains(p.Id) == true).ToList(); var addedServers = cluster.Servers.Where(x => dbcluster.Servers.Select(p => p.Id).Contains(x.Id) == false).ToList(); foreach (var removedserver in removedServers) { dbcluster.Servers.Remove(removedserver); } foreach (var updatedserver in updatedServers) { var server = cluster.Servers.Where(p => p.Id == updatedserver.Id).FirstOrDefault(); updatedserver.IP = server.IP; updatedserver.Name = server.Name; updatedserver.MicroServices.Clear(); if (server.Services != null) { foreach (var service in server.Services) { MicroService dbservice = new MicroService(); dbservice.Name = service.Name; dbservice.Version = service.Version; updatedserver.MicroServices.Add(dbservice); } } } foreach (var addedserver in addedServers) { Server dbserver = new Server(); dbcluster.Servers.Add(dbserver); dbserver.IP = addedserver.IP; dbserver.Name = addedserver.Name; dbserver.MicroServices.Clear(); if (addedserver.Services != null) { foreach (var service in addedserver.Services) { MicroService dbservice = new MicroService(); dbservice.Name = service.Name; dbservice.Version = service.Version; dbserver.MicroServices.Add(dbservice); } } } DataContext.Instance.SaveChanges(); } return(dbcluster); }
public IEnumerable <WorkSchedule> GetWorkTable() { return(MicroService.GetWorkSchedule()); }
public static MicroService AddApplicationHost(this MicroService microservice) { microservice.Configuration.Modules.Add(new ApplicationHostExtensionsModule()); return(microservice); }
static int Main(string[] args) { return(MicroService .Configure() .Run()); }
public WorkSchedule GetWorkTable([FromBody] List <ReportModel> model, int id) { // id = 1; return(MicroService.GetWorkSchedule(model).ToList(). Where(wk => wk.Id == id).FirstOrDefault()); }
public WeightMicroService(int weight, MicroService service, int currentWeight) { Weight = weight; Service = service; CurrentWeight = currentWeight; }
public IEnumerable <WorkSchedule> GenerateWorkTable([FromBody] List <ReportModel> models) { return(MicroService.GetWorkSchedule(models)); }
// The name of your queue // const string QueueName = "homelibraryapp"; // QueueClient is thread-safe. Recommended that you cache // rather than recreating it on every request // QueueClient Client; // ManualResetEvent CompletedEvent = new ManualResetEvent(false); public WorkerRole() { microService = new MicroService(new ServiceSettings()) .WithStartupTask(() => new DbMigrator(new DbConnectionProvider(), new ScriptDirectoryProvider())); }