|
11 | 11 | from newrelic_lambda_cli.integrations import _get_license_key_policy_arn |
12 | 12 | from newrelic_lambda_cli.types import LayerInstall, LayerUninstall |
13 | 13 |
|
| 14 | +NEW_RELIC_ENV_VARS = ( |
| 15 | + "NEW_RELIC_ACCOUNT_ID", |
| 16 | + "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS", |
| 17 | + "NEW_RELIC_LAMBDA_EXTENSION_ENABLED", |
| 18 | + "NEW_RELIC_LAMBDA_HANDLER", |
| 19 | + "NEW_RELIC_LICENSE_KEY", |
| 20 | + "NEW_RELIC_LOG_ENDPOINT", |
| 21 | + "NEW_RELIC_TELEMETRY_ENDPOINT", |
| 22 | +) |
| 23 | + |
14 | 24 |
|
15 | 25 | def index(region, runtime): |
16 | 26 | req = requests.get( |
@@ -120,14 +130,9 @@ def _add_new_relic(input, config, nr_license_key): |
120 | 130 | "NEW_RELIC_LAMBDA_EXTENSION_ENABLED" |
121 | 131 | ] = "true" |
122 | 132 |
|
123 | | - if input.enable_extension_function_logs: |
124 | | - update_kwargs["Environment"]["Variables"][ |
125 | | - "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS" |
126 | | - ] = "true" |
127 | | - else: |
128 | | - update_kwargs["Environment"]["Variables"][ |
129 | | - "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS" |
130 | | - ] = "false" |
| 133 | + update_kwargs["Environment"]["Variables"][ |
| 134 | + "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS" |
| 135 | + ] = ("true" if input.enable_extension_function_logs else "false") |
131 | 136 |
|
132 | 137 | if input.nr_region == "staging": |
133 | 138 | update_kwargs["Environment"]["Variables"][ |
@@ -242,7 +247,7 @@ def _remove_new_relic(input, config): |
242 | 247 | .get("Environment", {}) |
243 | 248 | .get("Variables", {}) |
244 | 249 | .items() |
245 | | - if not key.startswith("NEW_RELIC") |
| 250 | + if key not in NEW_RELIC_ENV_VARS |
246 | 251 | } |
247 | 252 |
|
248 | 253 | # Remove New Relic layers |
|
0 commit comments