summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/ConfigModels
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-07-07 00:39:52 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-09-14 18:47:21 -0400
commit2b3f0e740bc09630e881c9967e5ad53d66384094 (patch)
treeb95145d97b0abc0413220e139db88b287ea695fc /src/SMAPI.Web/Framework/ConfigModels
parente00fb85ee7822bc7fed2d6bd5a2e4c207a799418 (diff)
downloadSMAPI-2b3f0e740bc09630e881c9967e5ad53d66384094.tar.gz
SMAPI-2b3f0e740bc09630e881c9967e5ad53d66384094.tar.bz2
SMAPI-2b3f0e740bc09630e881c9967e5ad53d66384094.zip
make MongoDB database name configurable (#651)
Diffstat (limited to 'src/SMAPI.Web/Framework/ConfigModels')
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/MongoDbConfig.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/SMAPI.Web/Framework/ConfigModels/MongoDbConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/MongoDbConfig.cs
index 352eb960..3c508300 100644
--- a/src/SMAPI.Web/Framework/ConfigModels/MongoDbConfig.cs
+++ b/src/SMAPI.Web/Framework/ConfigModels/MongoDbConfig.cs
@@ -17,20 +17,22 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
/// <summary>The MongoDB password (if any).</summary>
public string Password { get; set; }
+ /// <summary>The database name.</summary>
+ public string Database { get; set; }
+
/*********
** Public method
*********/
/// <summary>Get the MongoDB connection string.</summary>
- /// <param name="authDatabase">The initial database for which to authenticate.</param>
- public string GetConnectionString(string authDatabase)
+ public string GetConnectionString()
{
bool isLocal = this.Host == "localhost";
bool hasLogin = !string.IsNullOrWhiteSpace(this.Username) && !string.IsNullOrWhiteSpace(this.Password);
return $"mongodb{(isLocal ? "" : "+srv")}://"
+ (hasLogin ? $"{Uri.EscapeDataString(this.Username)}:{Uri.EscapeDataString(this.Password)}@" : "")
- + $"{this.Host}/{authDatabase}retryWrites=true&w=majority";
+ + $"{this.Host}/{this.Database}?retryWrites=true&w=majority";
}
}
}