Skip to content

Commit

Permalink
Add ConnectionString argument
Browse files Browse the repository at this point in the history
  • Loading branch information
axelmarquezh committed Feb 20, 2024
1 parent b00b70d commit be39647
Showing 1 changed file with 5 additions and 35 deletions.
40 changes: 5 additions & 35 deletions Utilities/GenerateSecurityGraphs/GenerateSecurityGraphs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,11 @@ internal class Options
[Option('f', "force", Default = false, HelpText = "Create a folder at that path if one doesn't already exist.")]
public bool Force { get; set; }

[Option('d', "database", Default = "EdFi_Security", HelpText = "The name of the database containing the authorization metadata.")]
public string Database { get; set; }

[Option(
's', "server", Default = "(local)", HelpText = "The name of the SQL Server where the authorization metadata database is located.")]
public string Server { get; set; }

[Option(
'u', "user", HelpText =
"The SQL Server username to use for connecting to the authorization metadata database. Leave username and password blank to use integrated security.")]
public string User { get; set; }

[Option(
'p', "password", HelpText =
"The password to use for connecting to the authorization metadata database. Leave username and password blank to use integrated security.")]
public string Password { get; set; }
'c', "connectionString",
Default = "Server=(local);Database=EdFi_Security;Trusted_Connection=True;Encrypt=False",
HelpText = "The connection string for connecting to the authorization metadata database. Leave blank to connect to the local 'EdFi_Security' database using integrated security.")]
public string ConnectionString { get; set; }

[Option(
'g', "graphviz", Default = @"C:/Program Files/Graphviz/", HelpText =
Expand Down Expand Up @@ -97,25 +86,6 @@ private static async Task Main(string[] args)

if (failedToParse) return;

string connectionString;

if (options.User == null || options.Password == null)
{
connectionString = string.Format(
"Server={0};Database={1};Trusted_Connection=True;Encrypt=False",
options.Server,
options.Database);
}
else
{
connectionString = string.Format(
"Server={0};Database={1};User ID={2};Password={3};Encrypt=False",
options.Server,
options.Database,
options.User,
options.Password);
}

string baseFolderPath;

if (Path.IsPathRooted(options.OutputFolder))
Expand Down Expand Up @@ -179,7 +149,7 @@ private static async Task Main(string[] args)
Console.WriteLine("Generating graphs, please wait ...");

// Load all authorization metadata into a graph and a list of claim sets
var resourceGraph = LoadAuthorizationMetadataGraph(connectionString, out var claimSetNames);
var resourceGraph = LoadAuthorizationMetadataGraph(options.ConnectionString, out var claimSetNames);
var rootNodes = GetRootNodes(resourceGraph);

var assetsSourceFolder = Path.Combine(
Expand Down

0 comments on commit be39647

Please sign in to comment.