From 7656c6dcc33e4c969dcd23d83d0c4dae5fc29d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Andr=C3=A9=C3=AFs?= Date: Fri, 12 Jan 2018 09:53:10 +0100 Subject: [PATCH 1/4] Doesn't matter if Pushrequest upates AppVeyor build numbers --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 440c2e2..826d24a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,4 @@ version: '{build}' -pull_requests: - do_not_increment_build_number: true image: Visual Studio 2017 Preview clone_depth: 1 init: From d2fb6df3359bfe6d85d80f3849c370eff7616cfb Mon Sep 17 00:00:00 2001 From: chwebdude Date: Sun, 14 Jan 2018 09:32:19 +0100 Subject: [PATCH 2/4] Add osx Startscripts --- docs/RunScripts/CryptoManagerBootstrap | 5 +++++ docs/RunScripts/StartCryptoManager | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 docs/RunScripts/CryptoManagerBootstrap create mode 100644 docs/RunScripts/StartCryptoManager diff --git a/docs/RunScripts/CryptoManagerBootstrap b/docs/RunScripts/CryptoManagerBootstrap new file mode 100644 index 0000000..8422676 --- /dev/null +++ b/docs/RunScripts/CryptoManagerBootstrap @@ -0,0 +1,5 @@ +#/bin/bash +echo Starting CryptoManager +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$parent_path" +./CryptoManager \ No newline at end of file diff --git a/docs/RunScripts/StartCryptoManager b/docs/RunScripts/StartCryptoManager new file mode 100644 index 0000000..9e7ee0c --- /dev/null +++ b/docs/RunScripts/StartCryptoManager @@ -0,0 +1,12 @@ +#/bin/bash +echo Starting CryptoManager +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$parent_path" +cd bin/ +open ./CryptoManagerBootstrap +echo "Wait for Startup..." +sleep 7 +open http://localhost:5000 +echo "You can close this window now" +exit 0 + From 7fcc18a2bba0611aa01eb35b5c445a9946c45aa9 Mon Sep 17 00:00:00 2001 From: chwebdude Date: Sun, 14 Jan 2018 09:32:57 +0100 Subject: [PATCH 3/4] Set directory for osx --- CryptoManager/Startup.cs | 12 +++++++++--- Model/CryptoContext.cs | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CryptoManager/Startup.cs b/CryptoManager/Startup.cs index 43d5aa7..50c5888 100644 --- a/CryptoManager/Startup.cs +++ b/CryptoManager/Startup.cs @@ -32,12 +32,18 @@ public Startup(IConfiguration configuration) public IConfiguration Configuration { get; } + // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + var rootPath = Directory.GetCurrentDirectory(); + var parent = Directory.GetParent(rootPath); + var dataDir = Path.Combine(parent.FullName, "data"); + CryptoContext.DatabaseFile = Path.Combine(dataDir, "crypto.db"); + services.AddMvc(); - Directory.CreateDirectory("../data"); - var connection = "Data Source = ../data/crypto.db"; + Directory.CreateDirectory(dataDir); + var connection = "Data Source = '" + CryptoContext.DatabaseFile + "'"; services.AddDbContext(options => options.UseSqlite(connection)); // Add some Swag @@ -94,7 +100,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) // Enable Hangfire app.UseHangfireDashboard(); app.UseHangfireServer(); - + // Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(); diff --git a/Model/CryptoContext.cs b/Model/CryptoContext.cs index 0412503..4ffb3ae 100644 --- a/Model/CryptoContext.cs +++ b/Model/CryptoContext.cs @@ -10,10 +10,11 @@ namespace CryptoManager.Models public class CryptoContext : DbContext { public CryptoContext(DbContextOptions options) : base(options) { } + public static string DatabaseFile; protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - optionsBuilder.UseSqlite("Data Source=../data/crypto.db"); + optionsBuilder.UseSqlite("Data Source='" + CryptoContext.DatabaseFile + "'"); } public DbSet Transactions { get; set; } From 112dc980e8832cfdf0c9c218a209f17a65884571 Mon Sep 17 00:00:00 2001 From: chwebdude Date: Sun, 14 Jan 2018 09:36:46 +0100 Subject: [PATCH 4/4] Config NLog with absolute path --- CryptoManager/Program.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CryptoManager/Program.cs b/CryptoManager/Program.cs index ecc8458..7209ae3 100644 --- a/CryptoManager/Program.cs +++ b/CryptoManager/Program.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; +using NLog; using NLog.Web; namespace CryptoManager @@ -15,10 +16,14 @@ public class Program { public static void Main(string[] args) { - var logger = NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); + var rootPath = Directory.GetCurrentDirectory(); + var nlogConfig = Path.Combine(rootPath, "NLog.config"); + NLogBuilder.ConfigureNLog(nlogConfig); + var logger = LogManager.GetCurrentClassLogger(); + try { - logger.Debug("init main"); + logger.Debug("Start Webhost"); BuildWebHost(args).Run(); } catch (Exception e)