Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ConfigGenerators/CosmosCommands.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
init --config "dab-config.Cosmos.json" --database-type "cosmos" --connection-string "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==" --cosmos-database "graphqldb" --cosmos-container "planet" --graphql-schema "schema.gql" --host-mode Development --authenticate-devmode-requests false --cors-origin "http://localhost:5000"
init --config "dab-config.Cosmos.json" --database-type "cosmos" --connection-string "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==" --cosmosdb_nosql-database "graphqldb" --cosmosdb_nosql-container "planet" --graphql-schema "schema.gql" --host-mode Development --authenticate-devmode-requests false --cors-origin "http://localhost:5000"
add Planet --config "dab-config.Cosmos.json" --source "graphqldb.planet" --permissions "anonymous:create,read,update,delete" --rest false --graphql "Planet:Planets"
update Planet --config "dab-config.Cosmos.json" --permissions "authenticated:create,read,update,delete"
add Character --config "dab-config.Cosmos.json" --source "graphqldb.character" --permissions "authenticated:create,read,update,delete" --rest false --graphql "Character:Characters"
Expand Down
16 changes: 8 additions & 8 deletions src/Cli/src/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class InitOptions : Options
public InitOptions(
DatabaseType databaseType,
string? connectionString,
string? cosmosDatabase,
string? cosmosContainer,
string? cosmosNoSqlDatabase,
string? cosmosNoSqlContainer,
string? graphQLSchemaPath,
HostModeType hostMode,
IEnumerable<string>? corsOrigin,
Expand All @@ -40,8 +40,8 @@ public InitOptions(
{
DatabaseType = databaseType;
ConnectionString = connectionString;
CosmosDatabase = cosmosDatabase;
CosmosContainer = cosmosContainer;
CosmosNoSqlDatabase = cosmosNoSqlDatabase;
CosmosNoSqlContainer = cosmosNoSqlContainer;
GraphQLSchemaPath = graphQLSchemaPath;
HostMode = hostMode;
CorsOrigin = corsOrigin;
Expand All @@ -54,11 +54,11 @@ public InitOptions(
[Option("connection-string", Required = false, HelpText = "(Default: '') Connection details to connect to the database.")]
public string? ConnectionString { get; }

[Option("cosmos-database", Required = false, HelpText = "Database name for Cosmos DB.")]
public string? CosmosDatabase { get; }
[Option("cosmosdb_nosql-database", Required = false, HelpText = "Database name for Cosmos DB.")]
public string? CosmosNoSqlDatabase { get; }

[Option("cosmos-container", Required = false, HelpText = "Container name for Cosmos DB.")]
public string? CosmosContainer { get; }
[Option("cosmosdb_nosql-container", Required = false, HelpText = "Container name for Cosmos DB.")]
public string? CosmosNoSqlContainer { get; }

[Option("graphql-schema", Required = false, HelpText = "GraphQL schema Path.")]
public string? GraphQLSchemaPath { get; }
Expand Down
6 changes: 3 additions & 3 deletions src/Cli/src/ConfigGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public static bool TryCreateRuntimeConfig(InitOptions options, out string runtim
{
case DatabaseType.cosmos:
case DatabaseType.cosmosdb_nosql:
string? cosmosDatabase = options.CosmosDatabase;
string? cosmosContainer = options.CosmosContainer;
string? cosmosDatabase = options.CosmosNoSqlDatabase;
string? cosmosContainer = options.CosmosNoSqlContainer;
string? graphQLSchemaPath = options.GraphQLSchemaPath;
if (string.IsNullOrEmpty(cosmosDatabase) || string.IsNullOrEmpty(graphQLSchemaPath))
{
Console.WriteLine($"Provide all the mandatory options for CosmosDB_NoSql: --cosmos-database, and --graphql-schema");
Console.WriteLine($"Provide all the mandatory options for CosmosDB_NoSql: --cosmosdb_nosql-database, and --graphql-schema");
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Cli/test/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class EndToEndTests
public void TestInitForCosmosDBNoSql()
{
string[] args = { "init", "-c", _testRuntimeConfig, "--database-type", "cosmosdb_nosql",
"--connection-string", "localhost:5000", "--authenticate-devmode-requests", "True", "--cosmos-database",
"graphqldb", "--cosmos-container", "planet", "--graphql-schema", "schema.gql", "--cors-origin", "localhost:3000,www.nolocalhost.com:80" };
"--connection-string", "localhost:5000", "--authenticate-devmode-requests", "True", "--cosmosdb_nosql-database",
"graphqldb", "--cosmosdb_nosql-container", "planet", "--graphql-schema", "schema.gql", "--cors-origin", "localhost:3000,www.nolocalhost.com:80" };
Program.Main(args);

RuntimeConfig? runtimeConfig = TryGetRuntimeConfig(_testRuntimeConfig);
Expand Down
30 changes: 15 additions & 15 deletions src/Cli/test/InitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public void MssqlDatabase()
InitOptions options = new(
databaseType: DatabaseType.mssql,
connectionString: "testconnectionstring",
cosmosDatabase: null,
cosmosContainer: null,
cosmosNoSqlDatabase: null,
cosmosNoSqlContainer: null,
graphQLSchemaPath: null,
hostMode: HostModeType.Development,
corsOrigin: new List<string>() { "http://localhost:3000", "http://nolocalhost:80" },
Expand Down Expand Up @@ -57,8 +57,8 @@ public void CosmosDbPostgreSqlDatabase()
InitOptions options = new(
databaseType: DatabaseType.cosmosdb_postgresql,
connectionString: "testconnectionstring",
cosmosDatabase: null,
cosmosContainer: null,
cosmosNoSqlDatabase: null,
cosmosNoSqlContainer: null,
graphQLSchemaPath: null,
hostMode: HostModeType.Development,
corsOrigin: new List<string>() { "http://localhost:3000", "http://nolocalhost:80" },
Expand Down Expand Up @@ -96,8 +96,8 @@ public void TestInitializingConfigWithoutConnectionString()
InitOptions options = new(
databaseType: DatabaseType.mssql,
connectionString: null,
cosmosDatabase: null,
cosmosContainer: null,
cosmosNoSqlDatabase: null,
cosmosNoSqlContainer: null,
graphQLSchemaPath: null,
hostMode: HostModeType.Development,
corsOrigin: new List<string>() { "http://localhost:3000", "http://nolocalhost:80" },
Expand Down Expand Up @@ -126,16 +126,16 @@ public void TestInitializingConfigWithoutConnectionString()
}

/// <summary>
/// Test cosmosdb_nosql specifc settings like cosmos-database, cosmos-container, cosmos-schema file.
/// Test cosmosdb_nosql specifc settings like cosmosdb_nosql-database, cosmosdb_nosql-container, cosmos-schema file.
/// </summary>
[TestMethod]
public void CosmosDbNoSqlDatabase()
{
InitOptions options = new(
databaseType: DatabaseType.cosmosdb_nosql,
connectionString: "testconnectionstring",
cosmosDatabase: "testdb",
cosmosContainer: "testcontainer",
cosmosNoSqlDatabase: "testdb",
cosmosNoSqlContainer: "testcontainer",
graphQLSchemaPath: "schemafile",
hostMode: HostModeType.Production,
corsOrigin: null,
Expand Down Expand Up @@ -186,8 +186,8 @@ public void VerifyRequiredOptionsForCosmosDbNoSqlDatabase(
InitOptions options = new(
databaseType: DatabaseType.cosmosdb_nosql,
connectionString: "testconnectionstring",
cosmosDatabase: cosmosDatabase,
cosmosContainer: cosmosContainer,
cosmosNoSqlDatabase: cosmosDatabase,
cosmosNoSqlContainer: cosmosContainer,
graphQLSchemaPath: graphQLSchema,
hostMode: HostModeType.Production,
corsOrigin: null,
Expand All @@ -208,8 +208,8 @@ public void EnsureFailureOnReInitializingExistingConfig()
InitOptions options = new(
databaseType: DatabaseType.mssql,
connectionString: "testconnectionstring",
cosmosDatabase: null,
cosmosContainer: null,
cosmosNoSqlDatabase: null,
cosmosNoSqlContainer: null,
graphQLSchemaPath: null,
hostMode: HostModeType.Development,
corsOrigin: new List<string>() { },
Expand Down Expand Up @@ -272,8 +272,8 @@ private static InitOptions GetSampleInitOptionsWithFileName(string fileName)
InitOptions options = new(
databaseType: DatabaseType.mssql,
connectionString: "testconnectionstring",
cosmosDatabase: null,
cosmosContainer: null,
cosmosNoSqlDatabase: null,
cosmosNoSqlContainer: null,
graphQLSchemaPath: null,
hostMode: HostModeType.Production,
corsOrigin: new List<string>() { },
Expand Down