ln.templates/ln.templates.service/Program.cs

41 lines
1.1 KiB
C#

using System;
using System.IO;
using ln.bootstrap;
using ln.http;
using ln.templates.service;
public class TemplateServiceApplication
{
public static void Main(String[] arguments)
{
var app = new TemplateServiceApplication(arguments);
app.Run();
}
public string StoragePath { get; private set; } = Path.GetFullPath("storage");
public short ServicePort { get; private set; } = 8890;
public TemplateServiceApplication(string[] arguments)
{
string[] unused = new Options(
new Option('s',"storage", (v)=>StoragePath = v),
new Option('p',"port", (v)=>ServicePort = short.Parse(v))
)
.Parse(arguments);
Console.WriteLine("Unused Arguments: ", String.Join(" , ", unused));
}
public void Run()
{
TemplateService templateService = new TemplateService(StoragePath);
HttpTemplateEndpoints httpTemplateEndpoints = new HttpTemplateEndpoints(templateService);
Listener httpListener = new Listener(httpTemplateEndpoints, ServicePort);
Console.ReadKey();
}
}