-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from qJake/project-updates
1.0.2: Hass.io fixes
- Loading branch information
Showing
6 changed files
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
HADotNet.CommandCenter/Utils/RequiredStandaloneAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace HADotNet.CommandCenter.Utils | ||
{ | ||
public class RequiredStandaloneAttribute : ValidationAttribute | ||
{ | ||
protected override ValidationResult IsValid(object value, ValidationContext validationContext) | ||
{ | ||
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("HASSIO_TOKEN"))) | ||
{ | ||
return ValidationResult.Success; | ||
} | ||
|
||
return string.IsNullOrWhiteSpace(value?.ToString()) ? new ValidationResult(validationContext.DisplayName + " is required.") : ValidationResult.Success; | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters