-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Optimera network call to use https #3580
Comments
If anyone builds prebid manually you can add this script to your package.json to fix the url during the build process. package.json "scripts": {
"build": "./scripts/build.sh && node ./scripts/fix-optimera.js",
"prebid:upgrade": "npm upgrade prebid.js && npm run build"
}, build.sh #!/usr/bin/env bash
rm ./dist/prebid.js
cd ./node_modules/prebid.js
npm install
# Check if prebid-modules.json files exist.
if [ -f "../../modules.json" ];
then
gulp build --modules=../../modules.json
echo "modules.json file found.";
else
gulp build
echo "modules.json file does not exist. Create one to bundle certain modules only.";
fi
# Check if output directory exists.
if [ -d "../../dist" ];
then
echo "dist/ directory exists.";
else
mkdir "../../dist";
echo "Directory does not exist, creating destination directory.";
fi
# copy the build into the root directory
cp ./build/dist/prebid.js ../../dist/prebid.js
fix-optimera.js const fs = require('fs');
const path = require('path');
const prebidFilePath = path.join(__dirname, '../', 'dist', 'prebid.js');
const srcPath = prebidFilePath;
const destPath = prebidFilePath;
const regex = /http:\/\/dyv1bugovvq1g\.cloudfront\.net/;
const replacement = 'https://dyv1bugovvq1g.cloudfront.net'
const replaceOptimeraURL = () => new Promise((resolve, reject) => {
fs.readFile(srcPath, { encoding: 'utf8' }, (err, data) => {
if (err) return reject(err);
if (!regex.test(data)) return reject('Optimera url not found.');
return resolve(data.replace(regex, replacement))
});
});
/**
* Saves the prebid file.
*/
const savePrebidFile = data => new Promise((resolve, reject) => {
fs.writeFile(destPath, data, err => {
if (err) reject(err);
else resolve();
});
});
replaceOptimeraURL()
.then(savePrebidFile)
.then(() => console.log('Optimera file patched!'))
.catch((err) => console.log(err)) |
nice script 👍 |
Should the protocol be dynamic? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Type of issue
Bug
Description
Update network request to use https.
The text was updated successfully, but these errors were encountered: