npm i fastify-ibm-cos -s
// ...Other Plugins
fastify.register(
require("fastify-ibm-cos"),
{
endpoint: "s3.eu.cloud-object-storage.appdomain.cloud",
apiKeyId: "api_key_id",
credentials: {
accessKeyId: "access_key_id",
secretAccessKey: "secret_access_key"
},
ibmAuthEndpoint: "https://iam.cloud.ibm.com/identity/token",
serviceInstanceId: "service_instance_id"
},
err => {
if (err) throw err;
}
);
fastify.get("/", (request, reply) => {
console.log(fastify.cos); // IBM COS instance here
});
The options are passed as-is to the underlying ibm-cos-sdk instance and as such one should consult the corresponding docs for what variables he/she should pass.
Licensed under GPLv3.