remove secrets from source code
parent
1b3d248da7
commit
1bd47f581e
|
@ -6,7 +6,9 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Corsinvest.ProxmoxVE.Api" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Corsinvest.ProxmoxVE.Api;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using ProxmoxConnector.Integration.Abstractions;
|
||||
using System;
|
||||
|
@ -8,11 +9,26 @@ namespace ProxmoxConnector.Integration.Corsinvest.Services
|
|||
{
|
||||
internal class PveConnector : IPveConnector
|
||||
{
|
||||
private readonly string _hostName;
|
||||
private readonly int _port;
|
||||
private readonly string _userName;
|
||||
private readonly string _password;
|
||||
private readonly string _token;
|
||||
|
||||
public PveConnector(IConfiguration configuration)
|
||||
{
|
||||
var config = configuration.GetSection("Pve");
|
||||
_hostName = config["HostName"];
|
||||
_port = config.GetValue<int>("Port");
|
||||
_userName = config["UserName"];
|
||||
_password = config["Password"];
|
||||
_token = config["Token"];
|
||||
}
|
||||
|
||||
public async Task TestWithLogin()
|
||||
{
|
||||
//var client = new PveClient("***REMOVED***"); ***REMOVED*** ***REMOVED***
|
||||
var client = new PveClient("***REMOVED***"); ***REMOVED***
|
||||
if (await client.Login(***REMOVED***))
|
||||
var client = new PveClient(_hostName, _port);
|
||||
if (await client.Login(_userName, _password))
|
||||
{
|
||||
var vm = client.Nodes["pve-lora"].Qemu[100];
|
||||
|
||||
|
@ -46,16 +62,16 @@ namespace ProxmoxConnector.Integration.Corsinvest.Services
|
|||
public async Task TestWithToken()
|
||||
{
|
||||
//using Api Token
|
||||
var client2 = new PveClient("***REMOVED***");
|
||||
client2.ApiToken = "root@pam!test-token=***REMOVED***";
|
||||
var client2 = new PveClient(_hostName, _port);
|
||||
client2.ApiToken = _token;
|
||||
var version = await client2.Version.Version();
|
||||
Console.WriteLine(JsonConvert.SerializeObject(version.Response.data, Formatting.Indented));
|
||||
}
|
||||
|
||||
public async Task Start()
|
||||
{
|
||||
var client = new PveClient("***REMOVED***"); ***REMOVED***
|
||||
if (await client.Login(***REMOVED***))
|
||||
var client = new PveClient(_hostName, _port);
|
||||
if (await client.Login(_userName, _password))
|
||||
{
|
||||
var vm = client.Nodes["pve-lora"].Qemu[100];
|
||||
|
||||
|
@ -68,8 +84,8 @@ namespace ProxmoxConnector.Integration.Corsinvest.Services
|
|||
|
||||
public async Task Stop()
|
||||
{
|
||||
var client = new PveClient("***REMOVED***"); ***REMOVED***
|
||||
if (await client.Login(***REMOVED***))
|
||||
var client = new PveClient(_hostName, _port);
|
||||
if (await client.Login(_userName, _password))
|
||||
{
|
||||
var vm = client.Nodes["pve-lora"].Qemu[100];
|
||||
|
||||
|
|
|
@ -15,5 +15,12 @@
|
|||
//"BaseAddress": "http://localhost:5063/"
|
||||
"BaseAddress": "https://toodle.ddns.net/identity-server-api/"
|
||||
},
|
||||
"Workspace": "Workspace"
|
||||
"Workspace": "Workspace",
|
||||
"Pve": {
|
||||
"HostName": "127.0.0.1",
|
||||
"Port": "8006",
|
||||
"UserName": "user",
|
||||
"Password": "pass",
|
||||
"Token": "user@pam!test-token=76****-***-***-***-1*******5a"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue