Back to all reviewers

Prefer external configuration

kubeflow/kubeflow
Based on 2 comments
JavaScript

Design applications to use external configuration sources rather than hardcoding values directly in source code. This allows for configuration changes without requiring code modifications or redeployment.

Configurations JavaScript

Reviewer Prompt

Design applications to use external configuration sources rather than hardcoding values directly in source code. This allows for configuration changes without requiring code modifications or redeployment.

When defining configurations that might change between environments or user preferences:

  • Use mechanisms like ConfigMaps, environment variables, or properly namespaced storage keys
  • Consider future extensibility in configuration design
  • Prefer dynamic configuration that can be updated without code changes

For example, instead of hardcoding allowed namespaces:

// Avoid this
export const ALL_NAMESPACES_ALLOWED_LIST = ['jupyter'];

// Prefer dynamic configuration loaded from an external source
export const ALL_NAMESPACES_ALLOWED_LIST = loadFromConfigMap('namespaces.allowed');

Similarly, when importing resources to support configurable features, consider importing complete libraries if it enables easier configuration through external sources:

// This allows for configurable icons via ConfigMap without source code changes
import '@polymer/iron-icons/communication-icons.js';
2
Comments Analyzed
JavaScript
Primary Language
Configurations
Category

Source Discussions