@pi-r/tinify 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3,9 +3,9 @@ const tinify = require("tinify");
|
|
|
3
3
|
const Compress = require("@e-mc/compress");
|
|
4
4
|
const types_1 = require("@e-mc/types");
|
|
5
5
|
function compress(options = {}, mimeType) {
|
|
6
|
-
const settings = this.module.tinify
|
|
7
|
-
const apiKey = options.apiKey || settings
|
|
8
|
-
const proxy = options.proxy || settings
|
|
6
|
+
const settings = this.module.tinify;
|
|
7
|
+
const apiKey = options.apiKey || settings?.api_key || this.settings.tinify_api_key || Compress.enabled("process.env.apply") && process.env.TINIFY_KEY || '';
|
|
8
|
+
const proxy = options.proxy || settings?.proxy || Compress.enabled("process.env.apply") && process.env.TINIFY_PROXY || '';
|
|
9
9
|
return async (data) => {
|
|
10
10
|
return new Promise((resolve, reject) => {
|
|
11
11
|
if (apiKey) {
|