1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

convert setup to use config.yml

This commit is contained in:
Kyle Spearrin
2018-08-30 11:35:44 -04:00
parent a1f0f04660
commit 310e6bcf61
14 changed files with 954 additions and 646 deletions

View File

@ -2,6 +2,8 @@
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
@ -192,5 +194,21 @@ namespace Bit.Setup
Console.WriteLine();
Console.ResetColor();
}
public static Func<object, string> ReadTemplate(string templateName)
{
var assembly = typeof(Helpers).GetTypeInfo().Assembly;
var fullTemplateName = $"Bit.Setup.Templates.{templateName}.hbs";
if(!assembly.GetManifestResourceNames().Any(f => f == fullTemplateName))
{
return null;
}
using(var s = assembly.GetManifestResourceStream(fullTemplateName))
using(var sr = new StreamReader(s))
{
var templateText = sr.ReadToEnd();
return HandlebarsDotNet.Handlebars.Compile(templateText);
}
}
}
}