| 74 | private envs: Record<string, any>; |
| 75 | |
| 76 | constructor() { |
| 77 | const env = useEnv(); |
| 78 | |
| 79 | this.envs = env['FLOWS_ENV_ALLOW_LIST'] ? pick(env, toArray(env['FLOWS_ENV_ALLOW_LIST'] as string)) : {}; |
| 80 | |
| 81 | const messenger = useBus(); |
| 82 | const logger = useLogger(); |
| 83 | |
| 84 | messenger.subscribe<FlowMessage>('flows', (event) => { |
| 85 | if (event.type === 'reload') { |
| 86 | this.reloadQueue.add(async () => { |
| 87 | if (this.isLoaded) { |
| 88 | await this.unload(); |
| 89 | await this.load(); |
| 90 | } else { |
| 91 | logger.warn('Flows have to be loaded before they can be reloaded'); |
| 92 | } |
| 93 | }); |
| 94 | } |
| 95 | }); |
| 96 | } |
| 97 | |
| 98 | public async initialize(): Promise<void> { |
| 99 | if (!this.isLoaded) { |