Skip to content

Clarify that --with-default-root-credentials only apply on first server start #2308

@YangSiJun528

Description

@YangSiJun528

Issue

The --with-default-root-credentials flag only works on first server start. (when no local_data directory exists)
On subsequent starts, the flag is ignored but the server still logs:

INFO iggy_server: Using default root credentials (username: iggy, password: iggy) - FOR DEVELOPMENT ONLY!

This misleads users into thinking the credentials are active when they're not.

This also affects users who manually set IGGY_ROOT_USERNAME and IGGY_ROOT_PASSWORD environment variables after the server has already created a root user.

Steps to Reproduce

# First run - creates root user with random password
cargo run --bin iggy-server
# Stop and restart with flag
cargo run --bin iggy-server -- --with-default-root-credentials
# Authentication fails
cargo run --example getting-started-producer

Root Cause

The flag sets IGGY_ROOT_USERNAME=iggy and IGGY_ROOT_PASSWORD=iggy environment variables, but load_users() in core/server/src/streaming/systems/users.rs only creates a new root user when users.is_empty().
Since local_data already contains the user from the first run, the flag is silently ignored.

Proposed Fix

  • Add warning log when flag/environment variables are used but users already exist
  • Add information in README that existing user data persists across restarts
  • Update CLI help text to clarify this behavior (CLI help already mentions this)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions