Skip to content
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

Add default user and password #130

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/samba.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def main(data: None | str | pathlib.Path = None, tunnel: bool = False) -> None:
env["USERID"] = str(os.getuid())
env["GROUPID"] = str(os.getgid())
assert env["AXIS_DEVICE_IP"]
assert env["AXIS_DEVICE_PASS"]
assert env["AXIS_DEVICE_USER"]
env.setdefault("AXIS_DEVICE_PASS", "pass")
env.setdefault("AXIS_DEVICE_USER", "root")

cmd = ["docker", "compose"]
if tunnel:
Expand Down
4 changes: 2 additions & 2 deletions crates/acap-ssh-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Commands:

Options:
--host <HOST> Hostname or IP address of the device [env: AXIS_DEVICE_IP=]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=, default="root"]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=, default="pass"]
-h, --help Print help (see more with '--help')
```
4 changes: 2 additions & 2 deletions crates/acap-ssh-utils/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ struct Netloc {
#[arg(long, value_parser = url::Host::parse, env="AXIS_DEVICE_IP")]
host: Host,
/// The username to use for the ssh connection.
#[clap(short, long, env = "AXIS_DEVICE_USER")]
#[clap(short, long, env = "AXIS_DEVICE_USER", default_value = "root")]
user: String,
/// The password to use for the ssh connection.
#[clap(short, long, env = "AXIS_DEVICE_PASS")]
#[clap(short, long, env = "AXIS_DEVICE_PASS", default_value = "pass")]
pass: String,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/acap-vapix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ fn from_dbus() -> anyhow::Result<HttpClient> {
}

fn from_env() -> anyhow::Result<HttpClient> {
let username = env::var("AXIS_DEVICE_USER")?;
let password = env::var("AXIS_DEVICE_PASS")?;
let username = env::var("AXIS_DEVICE_USER").unwrap_or("root".into());
let password = env::var("AXIS_DEVICE_PASS").unwrap_or("pass".into());
kjughx marked this conversation as resolved.
Show resolved Hide resolved
let host = env::var("AXIS_DEVICE_IP")?;
let url = Url::parse(&format!("http://{host}"))?;
debug!("Creating client using username {username} from env");
Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-acap-sdk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ struct DeployOptions {
/// Username of SSH- and/or VAPIX-account to authenticate as.
///
/// It is up to the user to ensure that these have been created on the device as needed.
#[clap(long, env = "AXIS_DEVICE_USER")]
#[clap(long, env = "AXIS_DEVICE_USER", default_value = "root")]
user: String,
/// Password of SSH- and/or VAPIX-account to authenticate as.
///
/// It is up to the user to ensure that these have been created on the device as needed.
// TODO: Consider disallowing passing password as arguments.
#[clap(long, env = "AXIS_DEVICE_PASS")]
#[clap(long, env = "AXIS_DEVICE_PASS", default_value = "pass")]
pass: String,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/device-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Commands:

Options:
--host <HOST> Hostname or IP address of the device [env: AXIS_DEVICE_IP=]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=]
-u, --user <USER> The username to use for the ssh connection [env: AXIS_DEVICE_USER=, default="root"]
-p, --pass <PASS> The password to use for the ssh connection [env: AXIS_DEVICE_PASS=, default="pass"]
-h, --help Print help
```

Expand Down
4 changes: 2 additions & 2 deletions crates/device-manager/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ struct Netloc {
#[arg(long, value_parser = url::Host::parse, env = "AXIS_DEVICE_IP")]
host: Host,
/// The username to use for the ssh connection.
#[clap(short, long, env = "AXIS_DEVICE_USER")]
#[clap(short, long, env = "AXIS_DEVICE_USER", default_value = "root")]
user: String,
/// The password to use for the ssh connection.
#[clap(short, long, env = "AXIS_DEVICE_PASS")]
#[clap(short, long, env = "AXIS_DEVICE_PASS", default_value = "pass")]
pass: String,
}

Expand Down