Personal website
1#!/bin/pwsh
2<#
3 This file is part of NKK.
4
5 NKK is free software: you can redistribute it and/or modify it under the
6 terms of the GNU Affero General Public License as published by the Free
7 Software Foundation, either version 3 of the License, or (at your option)
8 any later version.
9
10 NKK is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with NKK. If not, see <http://www.gnu.org/licenses/>.
17#>
18
19Import-Module Pode
20Import-Module Mizumiya
21
22# its called we do a little bit of trolling
23. (Get-Module Pode) {
24 # TLDR: purposefully and painfully trample the safety of psd1 files
25 # apparently, you can execute code in a module's scope, which allows us to
26 # hot-patch away the little obstacle of not being able to use "dynamic
27 # expressions" in the psd1 config file. the whole point of psd1 files is
28 # that they are a *safe* way to load data in powershell format, but I don't
29 # really care about that. personally, this feels akin to beating the runtime
30 # over the head with a wrench
31 # further reading: https://seeminglyscience.github.io/powershell/2017/09/30/invocation-operators-states-and-scopes
32 function Import-PowerShellDataFile {
33 [CmdletBinding()]
34 param (
35 [String] $Path
36 )
37
38 return (Invoke-Expression -Command (Get-Content -LiteralPath $Path -Raw) -ErrorAction Stop)
39 }
40}
41
42. ./functions.ps1
43
44Start-PodeServer {
45 # allow dynamic reload of routes without a full server restart (do Ctrl+R !)
46 . ./Routes.ps1
47}