From a614b5a7fcb46b9db5c1291067a11e2c1b3cc2df Mon Sep 17 00:00:00 2001 From: giuliano Date: Thu, 23 Nov 2023 18:17:20 -0300 Subject: [PATCH] 20231123 - troca de local do json --- Program.cs | 5 +++++ appsetings.json | 9 +++++---- data.cs | 9 +++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index f72c752..44342df 100644 --- a/Program.cs +++ b/Program.cs @@ -12,6 +12,8 @@ using System.Net.Quic; using Microsoft.Extensions.Configuration; using Newtonsoft.Json.Linq; using Newtonsoft.Json; +using Microsoft.Extensions.Configuration.UserSecrets; +using static System.Net.Mime.MediaTypeNames; class Program { @@ -20,7 +22,10 @@ class Program ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); IConfiguration configuration = configurationBuilder.AddUserSecrets().Build(); + if (configuration is null){ Environment.Exit(1); } + Console.Clear(); + // URL da API que vocĂȘ deseja chamar string ConnSourcePath = configuration.GetValue("DB_PATH"); string apiUrl = configuration.GetValue("PIPEFY_API_URL"); diff --git a/appsetings.json b/appsetings.json index 56a81a0..3ff9560 100644 --- a/appsetings.json +++ b/appsetings.json @@ -1,6 +1,7 @@ { - "MySecretValues": { - "Username": "Abc", - "Password": "Xyz" - } + "DB_PATH": "C:\\Users\\contratos\\Documents\\Giuliano\\Pipefy.accdb", + "PIPEFY_API_TOKEN": "eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJQaXBlZnkiLCJpYXQiOjE2OTg4NTYyMjcsImp0aSI6IjM2N2Y4M2NhLWZjODYtNGRhOC04ODEyLTkzODRkZGZkODc0MiIsInN1YiI6MzAyNTM0MzY2LCJ1c2VyIjp7ImlkIjozMDI1MzQzNjYsImVtYWlsIjoiYmFjazVAZW5lcmdpYXNtYXJ0LmNvbS5iciIsImFwcGxpY2F0aW9uIjozMDAyODkyNDgsInNjb3BlcyI6W119LCJpbnRlcmZhY2VfdXVpZCI6bnVsbH0.o13j9c_y3G3HX35qhX4PmkkibGsmlHsk5dL_Bxsr1CKV5Jlgj218kJdEmriS7aHiw0-P7sfs-bu4YcElfuyiqg", + "PIPEFY_API_URL": "https://api.pipefy.com/graphql", + "PIPEFY_TABLE_ID": "22HiedTk", + "PIPEFY_TABLE_ID_GESTORES": "nuyW2tji" } \ No newline at end of file diff --git a/data.cs b/data.cs index 2bd7f91..8cb1427 100644 --- a/data.cs +++ b/data.cs @@ -59,4 +59,13 @@ namespace Pipefy public string ?gestores { get; set; } } + + public class AppSettings + { + public string DB_PATH { get; set; } + public string PIPEFY_API_TOKEN { get; set; } + public string PIPEFY_API_URL { get; set; } + public string PIPEFY_TABLE_ID { get; set; } + public string PIPEFY_TABLE_ID_GESTORES { get; set; } + } }