add configuration

This commit is contained in:
2026-03-29 11:26:29 +08:00
parent 430138f620
commit 636d55da21
3 changed files with 14 additions and 3 deletions

View File

@@ -13,7 +13,11 @@ namespace Reader
public partial class MainForm : Form public partial class MainForm : Form
{ {
private static readonly HttpClient http = new HttpClient(); private static readonly HttpClient http = new HttpClient();
private const string ServerUrl = "http://192.168.0.125:5000"; private static readonly string ServerUrl = System.IO.File.ReadAllText("appsettings.json")
.Replace("\"", "")
.Split(':')[1]
.Replace("/", "")
.Trim();
public MainForm() public MainForm()
{ {

View File

@@ -12,7 +12,11 @@ namespace Writer
public partial class MainForm : Form public partial class MainForm : Form
{ {
private static readonly HttpClient http = new HttpClient(); private static readonly HttpClient http = new HttpClient();
private const string ServerUrl = " http://192.168.0.125:5000"; private static readonly string ServerUrl = System.IO.File.ReadAllText("appsettings.json")
.Replace("\"", "")
.Split(':')[1]
.Replace("/", "")
.Trim();
public MainForm() public MainForm()
{ {

3
client/appsettings.json Normal file
View File

@@ -0,0 +1,3 @@
{
"ServerUrl": "http://192.168.0.125:5000"
}