Skip to content

Commit

Permalink
add appsettings.json to .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jul 7, 2021
1 parent e067c3a commit c30df9e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Mobile.BuildTools.Reference/Utils/ConfigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,19 @@ public static void SaveDefaultConfig(string path)

#if !DEBUG // Do not generate .gitignore for local debug builds
var requiredContents = @"# Mobile.BuildTools
secrets.json
secrets.*.json
appsettings.json
appsettings.*.json
";
var gitignoreFile = Path.Combine(path, ".gitignore");
if (File.Exists(gitignoreFile))
if (!File.Exists(gitignoreFile))
{
if(!File.ReadAllText(gitignoreFile).Contains(Constants.SecretsJsonFileName))
{
File.AppendAllText(gitignoreFile, $"\n\n{requiredContents}");
}
File.WriteAllText(gitignoreFile, requiredContents);
}
else
else if(!File.ReadAllText(gitignoreFile).Contains(Constants.SecretsJsonFileName))
{
File.WriteAllText(gitignoreFile, requiredContents);
File.AppendAllText(gitignoreFile, $"\n\n{requiredContents}");
}

#endif
}

Expand Down

0 comments on commit c30df9e

Please sign in to comment.