Skip to content

Added safety checks for staticServeConfig#54

Merged
vinayak25 merged 1 commit intointentjs:mainfrom
alexandercerutti:fix/staticServeConfig
Jan 5, 2025
Merged

Added safety checks for staticServeConfig#54
vinayak25 merged 1 commit intointentjs:mainfrom
alexandercerutti:fix/staticServeConfig

Conversation

@alexandercerutti
Copy link
Contributor

This PR fixes the following problem:

http.staticServe is marked as optional in packages/core/lib/interfaces/config.ts

export interface HttpConfig {
cors?: CorsOptions | CorsOptionsDelegate<any>;
server?: ServerConstructorOptions;
staticServe?: {
httpPath?: string;
filePath?: string;
keep?: {
extensions?: string[];
};
cache?: {
max_file_count?: number;
max_file_size?: number;
};
};
}

This means that if you opt-out of static serving files (like I did, I wanted to create a simple-as-possible sample application because I'm developing a plugin so I don't need most of the things), the code is going to crash.

Two were the places where an intervention could be made: either in the place where I edited the code or in the interface.

Because I didn't know if http.staticServe config path is optional by mistake (please tell me it is), I rathered to use the first one because it is the least breaking path (not a breaking change).

Let me know.

@vinayak25 vinayak25 merged commit 761f362 into intentjs:main Jan 5, 2025
1 of 2 checks passed
@alexandercerutti alexandercerutti deleted the fix/staticServeConfig branch January 5, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants