Skip to content

feat: Allow setting a default server#777

Open
atheriel wants to merge 2 commits into
mainfrom
aj-set-default-server
Open

feat: Allow setting a default server#777
atheriel wants to merge 2 commits into
mainfrom
aj-set-default-server

Conversation

@atheriel
Copy link
Copy Markdown
Contributor

@atheriel atheriel commented Jun 1, 2026

Intent

With more than one entry in the servers.json file, the -s or -n would previously have become mandatory. This commit allows a server to be marked as the default, in which case it is assumed to be the target.

Closes #214.

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Approach

Specifically, rsconnect add now has a --set-default flag to mark a server as the default. For backwards compatibility we do not do this automatically.

For rsconnect login, on the other hand, we don't need to be backwards compatible -- it hasn't been released yet -- and so that command will make the server the default automatically (unless --no-set-default is passed).

Some care has been taken to keep precendence of flags and environment variables intact and ensure that only one server is the default at a time.

Automated Tests

Unit tests are included.

Directions for Reviewers

Please advise.

Checklist

  • I have updated CHANGELOG.md to cover notable changes.
  • I have updated all related GitHub issues to reflect their current state.
  • I have run the rsconnect-python-tests-at-night workflow in Connect against this feature branch.

With more than one entry in the `servers.json` file, the `-s` or `-n`
would previously have become mandatory. This commit allows a server to
be marked as the default, in which case it is assumed to be the target.

Specifically, `rsconnect add` now has a `--set-default` flag to mark a
server as the default. For backwards compatibility we do not do this
automatically.

For `rsconnect login`, on the other hand, we don't need to be backwards
compatible -- it hasn't been released yet -- and so that command will
make the server the default automatically (unless `--no-set-default` is
passed).

Some care has been taken to keep precendence of flags and environment
variables intact and ensure that only one server is the default at a
time.

Unit tests are included.

Closes #214.

Signed-off-by: Aaron Jacobs <[email protected]>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://posit-dev.github.io/rsconnect-python/pr-preview/pr-777/

Built to branch gh-pages at 2026-06-01 21:00 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

…s deploys

When shinyapps credentials (token/secret/account) are provided without
-n or -s, don't resolve the default Connect server — the user is
targeting shinyapps.io, not a stored server.

Also fixes black formatting that CI flagged.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6142 4792 78% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
rsconnect/api.py 78% 🟢
rsconnect/main.py 73% 🟢
rsconnect/metadata.py 86% 🟢
rsconnect/validation.py 72% 🟢
TOTAL 77% 🟢

updated for commit: 10e6522 by action🐍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to define a default server nickname

1 participant