Skip to content

Commit a4a192a

Browse files
committed
Change TaskConnection handling
1 parent 2c0134d commit a4a192a

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

MyApp.ServiceInterface/AppConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class AppConfig
2222
public string DeletedUserId { get; set; } = "1c6598f5-4f3e-4197-b525-3dc868b64f3e";
2323
public string[] FeaturedUserIds { get; set; } = [];
2424
public string DefaultConnection { get; set; }
25-
public string TaskConnection { get; set; }
25+
public string TaskConnection { get; set; } = "DataSource=App_Data/tasks/{db};Cache=Shared";
2626

2727
public string? GoogleClientId { get; set; }
2828
public string? GoogleClientSecret { get; set; }

MyApp.ServiceInterface/AppData.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,9 @@ public List<Artifact> GetFeaturedPortraitArtifacts(IDbConnection db, int take)
13571357

13581358
public IDbConnection OpenAiTaskDb(DateTime? createdDate=null)
13591359
{
1360+
if (Config.TaskConnection == null)
1361+
throw new Exception("TaskConnection not configured");
1362+
13601363
var date = createdDate ?? DateTime.UtcNow;
13611364

13621365
if (date.Year is < 2025 or > 2026)

MyApp/Configure.AppHost.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public void Configure(IWebHostBuilder builder) => builder
2424

2525
appConfig.DefaultConnection = Environment.GetEnvironmentVariable("COMFY_DB_CONNECTION")
2626
?? context.Configuration.GetConnectionString("DefaultConnection");
27-
appConfig.TaskConnection = context.Configuration.GetConnectionString("TaskConnection");
2827

2928
var artifactsPath = Environment.GetEnvironmentVariable("COMFY_GATEWAY_ARTIFACTS");
3029
appConfig.ArtifactsPath = artifactsPath ?? appConfig.ArtifactsPath;

MyApp/appsettings.Development.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
2-
"ConnectionStrings": {
3-
"DefaultConnection": "Host=localhost;Port=5432;Database=gateway;Username=gateway;Password=gateway;Include Error Detail=true;",
4-
"TaskConnection": "DataSource=../App_Data/tasks/{db};Cache=Shared"
5-
},
62
"DebugMode": true,
73
"DetailedErrors": true,
84
"Logging": {
@@ -24,6 +20,7 @@
2420
},
2521
"AppConfig": {
2622
"PublicBaseUrl": "https://gateway.com",
23+
"TaskConnection": "DataSource=../App_Data/tasks/{db};Cache=Shared",
2724
"AppDataPath": "../App_Data",
2825
"ArtifactsPath": "../App_Data/artifacts",
2926
"FilesPath": "../App_Data/files"

MyApp/appsettings.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"ConnectionStrings": {
3-
"TaskConnection": "DataSource=/app/App_Data/tasks/{db};Cache=Shared"
4-
},
52
"Logging": {
63
"IncludeScopes": false,
74
"Debug": {
@@ -23,6 +20,7 @@
2320
"FeaturedSubTitle": "Discover amazing AI-generated creations from our community.",
2421
"LocalBaseUrl": "https://localhost:5001",
2522
"PublicBaseUrl": "https://ubixar.com",
23+
"TaskConnection": "DataSource=/app/App_Data/tasks/{db};Cache=Shared",
2624
"AppDataPath": "/app/App_Data",
2725
"ArtifactsPath": "/app/App_Data/artifacts",
2826
"FilesPath": "/app/App_Data/files",

0 commit comments

Comments
 (0)