Skip to content

Commit d784c37

Browse files
committed
feat: add global config preComputeUrl
1 parent baa0a49 commit d784c37

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/decorators/attachment.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const attachment = (options?: LucidOptions) => {
2222
const defaultOptions = {
2323
meta: defaultConfig.meta !== undefined ? defaultConfig.meta : defaultOptionsDecorator.meta,
2424
rename: defaultConfig.rename !== undefined ? defaultConfig.rename : defaultOptionsDecorator.rename,
25+
preComputeUrl: defaultConfig.preComputeUrl !== undefined ? defaultConfig.preComputeUrl : defaultOptionsDecorator.preComputeUrl,
2526
}
2627

2728
if (!options || options?.meta === undefined) {
@@ -30,6 +31,9 @@ export const attachment = (options?: LucidOptions) => {
3031
if (!options || options?.rename === undefined) {
3132
options!.rename = defaultOptions.rename
3233
}
34+
if (!options || options?.preComputeUrl === undefined) {
35+
options!.preComputeUrl = defaultOptions.preComputeUrl
36+
}
3337

3438
target[optionsSym][attributeName] = options
3539

src/types/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type AttachmentConfig = {
2626
bin?: BinPaths
2727
meta?: boolean
2828
rename?: boolean
29+
preComputeUrl?: boolean
2930
converters?: ConverterConfig[]
3031
}
3132

@@ -38,5 +39,6 @@ export type ResolvedAttachmentConfig = {
3839
bin?: BinPaths
3940
meta?: boolean
4041
rename?: boolean
42+
preComputeUrl?: boolean
4143
converters?: ResolvedConverter[]
4244
}

src/utils/default_values.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export const defaultOptionsDecorator = {
1010
folder: 'uploads',
1111
preComputeUrl: false,
1212
variants: [],
13-
rename: true,
14-
meta: true
13+
meta: true,
14+
rename: true
1515
}
1616

1717
export const defaultStateAttributeMixin = {

0 commit comments

Comments
 (0)