Support for custom StorageConfig implementations #7835
Replies: 2 comments 3 replies
-
Thanks for the feature request @empperi, do you have any examples of where this flexibility would have helped you? |
Beta Was this translation helpful? Give feedback.
-
Researching But, and @empperi pointed out, I found out that actually Google Cloud Storage is "compatible" with S3, and you could actually use AWS library to store and get things out of GCS. Further reading for anyone else wondering here: https://cloud.google.com/storage/docs/aws-simple-migration. Certainly I wouldn't expect it to be a walk in the park, there will be of course a few issues, but I'll have them written here, and the way to overcome them. |
Beta Was this translation helpful? Give feedback.
-
Right now Keystone 6 supports two
StorageConfig
implementations:kind: "s3"
andkind: "local"
. This is very limiting and Keystone should allow users to write their own implementations if these do not suffice.Adding support for this should be rather simple. One needs to change the
StorageConfig
type declaration to be an interface out of which specific implementations are inherited and these then may add new properties. This would be a backwards compatible change in typing.Also at the code level it seems like these places are affecting this change:
keystone/packages/core/src/lib/assets/createImagesContext.ts
Lines 33 to 39 in b3fcc3e
and
keystone/packages/core/src/lib/assets/createFilesContext.ts
Lines 39 to 47 in b3fcc3e
In both cases these just do a crude if-else based logic on
kind
property and then initialize the appropriate implementation. To retain backwards compatibility such if-else logic should be kept but there should be a third check that if thestorageConfig
is already an instance ofStorageConfig
then it would just simply use that.This would provide ultimate flexibility without sacrificing backwards compatibility and it is a relatively simple and minor change to the codebase.
Beta Was this translation helpful? Give feedback.
All reactions