Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PSNotify to AptecoPSFramework #5

Open
gitfvb opened this issue Nov 3, 2023 · 4 comments
Open

Add PSNotify to AptecoPSFramework #5

gitfvb opened this issue Nov 3, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@gitfvb
Copy link
Contributor

gitfvb commented Nov 3, 2023

Think about definition of events in the module and subscribing notification groups to it.

@gitfvb gitfvb self-assigned this Nov 3, 2023
@gitfvb gitfvb added the enhancement New feature or request label Nov 3, 2023
@gitfvb
Copy link
Contributor Author

gitfvb commented Nov 3, 2023

  • Implement a check at start Is-PSNotifyConfigured to see if there are notification groups
  • Create a wrapper function for notifications in the main module
  • Add notifications always to the plugin and add an array of something like the example
[PSCustomObject]@{
    "active" = $false
    "notificationGroup" = "4f88dea2-d3b3-47bf-8978-07e745b71cc6"
    "notificationName" = "401 Unauthorized" # should not be changed as this is the reference in the code
    "message" = "The token {0} is expired, please check {1}"
    "subject" = "" # relevant, if email
}

The message part should be rendered by .replace("{0}",$var1).replace("{1}",$var2)

@gitfvb
Copy link
Contributor Author

gitfvb commented Nov 3, 2023

  • Create only warnings. Do not let the main process be interrupted, if the notification fails.

@gitfvb
Copy link
Contributor Author

gitfvb commented Nov 8, 2023

At install of psframework ask for installing psnitify

At module import of psframework try to import psnotify, if successful, ask for if it is configurated. Fill a module scope boolean for later usage like $isPSNotifyConfigured

Then connect events with this boolean and specified channels.

Weekly Update check with notifications in psframework. Ask for it at install.

@gitfvb
Copy link
Contributor Author

gitfvb commented Nov 22, 2023

More requirements, maybe rename everything in "notification hooks":

  • Add prefix for all messages in settings file
  • There should be two areas in the notification settings area, 1. generic (like failed to load settings, update available etc.), 2. plugin specific hooks
  • Psnotify could be easily integrated into boilerplate

And this is a better way to replace tokens in a string

PS C:\Users\Florian> "hello world" -f "new"
hello world
PS C:\Users\Florian> "hello {0} world" -f "new"
hello new world
PS C:\Users\Florian> "hello {0} world" -f "new", "wide"
hello new world
PS C:\Users\Florian> "hello {0} {1} world" -f "new", "wide"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant