initial upload
This commit is contained in:
parent
a0aa9cc28e
commit
f857f43df4
553 changed files with 46169 additions and 13 deletions
14
src/Agent/Insight.Agent/Extensions/Configuration.cs
Normal file
14
src/Agent/Insight.Agent/Extensions/Configuration.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Insight.Agent.Extensions
|
||||
{
|
||||
public static class ConfigurationExtensions
|
||||
{
|
||||
public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
|
||||
{
|
||||
configuration.Sources.Clear();
|
||||
configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||||
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
src/Agent/Insight.Agent/Extensions/Linux.cs
Normal file
32
src/Agent/Insight.Agent/Extensions/Linux.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Insight.Agent.Extensions
|
||||
{
|
||||
public static class Linux
|
||||
{
|
||||
[SupportedOSPlatform("linux")]
|
||||
public static string Bash(this string cmd)
|
||||
{
|
||||
var escaped = cmd.Replace("\"", "\\\"");
|
||||
|
||||
using var proc = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "/bin/bash",
|
||||
Arguments = $"-c \"{escaped}\"",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
}
|
||||
};
|
||||
|
||||
proc.Start();
|
||||
var result = proc.StandardOutput.ReadToEnd();
|
||||
proc.WaitForExit();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue