main
| 1 | import { discoverPoliciesFromDir } from "@medusajs/utils" |
| 2 | import { normalize } from "path" |
| 3 | |
| 4 | /** |
| 5 | * Load RBAC policies from a directory |
| 6 | * @param sourcePath - Path to scan for policies directories |
| 7 | */ |
| 8 | export async function policiesLoader(sourcePath?: string): Promise<void> { |
| 9 | if (!sourcePath) { |
| 10 | return |
| 11 | } |
| 12 | |
| 13 | const policyDir = normalize(sourcePath) |
| 14 | |
| 15 | await discoverPoliciesFromDir(policyDir) |
| 16 | } |