-
Notifications
You must be signed in to change notification settings - Fork 65
fix: truncate headers/redirects in logs #4183
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
Conversation
return netlifyConfig | ||
const netlifyConfigA = truncateArray(netlifyConfig, 'headers') | ||
const netlifyConfigB = truncateArray(netlifyConfigA, 'redirects') | ||
return netlifyConfigB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function, cleanupConfig()
is only used in code that prints the configuration object (GitHub search). It does not mutate its arguments, only return a new object. Therefore, it cannot modify the netlify.toml
used in deploys.
build/packages/build/src/log/messages/config.js
Lines 70 to 95 in f246f53
export const logConfig = function ({ logs, netlifyConfig, debug }) { | |
if (!debug) { | |
return | |
} | |
logSubHeader(logs, 'Resolved config') | |
logObject(logs, cleanupConfig(netlifyConfig)) | |
} | |
export const logConfigOnUpdate = function ({ logs, netlifyConfig, debug }) { | |
if (!debug) { | |
return | |
} | |
logSubHeader(logs, 'Updated config') | |
logObject(logs, cleanupConfig(netlifyConfig)) | |
} | |
export const logConfigOnError = function ({ logs, netlifyConfig, severity }) { | |
if (netlifyConfig === undefined || severity === 'none') { | |
return | |
} | |
logMessage(logs, THEME.errorSubHeader('Resolved config')) | |
logObject(logs, cleanupConfig(netlifyConfig)) | |
} |
build/packages/config/src/log/main.js
Lines 17 to 48 in f246f53
// Log `defaultConfig` option in debug mode | |
export const logDefaultConfig = function (defaultConfig, { logs, debug, baseRelDir }) { | |
if (!debug || defaultConfig === undefined) { | |
return | |
} | |
logSubHeader(logs, 'UI build settings') | |
logObject(logs, cleanupConfig({ ...defaultConfig, baseRelDir })) | |
} | |
// Log `inlineConfig` option in debug mode | |
export const logInlineConfig = function (initialConfig, { logs, debug }) { | |
if (!debug || Object.keys(initialConfig).length === 0) { | |
return | |
} | |
logSubHeader(logs, 'Configuration override') | |
logObject(logs, cleanupConfig(initialConfig)) | |
} | |
// Log return value of `@netlify/config` in debug mode | |
export const logResult = function ({ configPath, buildDir, config, context, branch, env }, { logs, debug }) { | |
if (!debug) { | |
return | |
} | |
logSubHeader(logs, 'Resolved build environment') | |
logObject(logs, { configPath, buildDir, context, branch, env: cleanupEnvironment(env) }) | |
logSubHeader(logs, 'Resolved config') | |
logObject(logs, cleanupConfig(config)) | |
} |
Fixes #4163
This PR re-enables #4172, but without the bug.
Also, regression tests have now been added to make sure re-enabling this PR is now safe.
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.