ViViDboarder / vaultwarden_ldap

Automate LDAP invites to Vaultwarden
GNU General Public License v3.0
155 stars 25 forks source link

thread 'main' panicked at 'Failed to open config file at config.toml', src/config.rs:25:9 #6

Closed trentnbauer closed 4 years ago

trentnbauer commented 4 years ago

So I'm running into the error above. From what I can see, I've mapped the config.toml file correctly Screenshot showing contents of config.toml and location Screenshot showing docker container variables from portainer

From the error message, I think this is gonna be a simple one so apologies in advanced!

ViViDboarder commented 4 years ago

No need to apologize. 😄

It seems like you're running in a container but that the path you're providing in the env variable is actually the absolute path on the host, not the path from within the container. When you spun up the container and added a volume for the config file, where did you mount it?

When using Docker, you can just mount the config file to the default location directly. That way you don't have to set the env variable at all. Here's what I typically do in the example compose file. https://github.com/ViViDboarder/bitwarden_rs_ldap/blob/master/docker-compose.yml#L8

If you're running on the command line, it'd be something more like:

docker run -d -v $(pwd)/config.toml:/usr/src/bitwarden_rs_ldap/config.toml:ro vividboarder/bitwarden_rs_ldap

If you don't like that location in the container, you can pass anything and set the env var. Eg.

docker run -d -v $(pwd)/config.toml:/container/path/config.toml:ro -e CONFIG_FILE=/container/path/config.toml vividboarder/bitwarden_rs_ldap

Key being that the destination path matches the env var, not the source path.

trentnbauer commented 4 years ago

Hi mate, Thanks heaps for the fast reply and being understanding! I'm still a little bit confused though, I'm unsure what to put in for the container, or does it not matter as long as the config_path variable matches? https://pasteboard.co/IGyJqO6.png

Edit: Just tried /config:/mnt/nfs/synology/bitwardenldap and CONFIG_FILE=/config/config.toml and same error;

note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.,
thread 'main' panicked at 'Failed to open config file at config.toml', src/config.rs:25:9
trentnbauer commented 4 years ago

Enabled backtrace;

2019-11-15T02:17:09.741965803Z   14: _start

2019-11-15T02:17:13.546717783Z thread 'main' panicked at 'Failed to open config file at config.toml', src/config.rs:25:9

2019-11-15T02:17:13.554265864Z stack backtrace:

2019-11-15T02:17:13.554345228Z    0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace

2019-11-15T02:17:13.570052717Z              at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39

2019-11-15T02:17:13.570074374Z    1: std::sys_common::backtrace::_print

2019-11-15T02:17:13.570082600Z              at src/libstd/sys_common/backtrace.rs:70

2019-11-15T02:17:13.570089905Z    2: std::panicking::default_hook::{{closure}}

2019-11-15T02:17:13.570098971Z              at src/libstd/sys_common/backtrace.rs:58

2019-11-15T02:17:13.570106266Z              at src/libstd/panicking.rs:200

2019-11-15T02:17:13.570113197Z    3: std::panicking::default_hook

2019-11-15T02:17:13.570120953Z              at src/libstd/panicking.rs:215

2019-11-15T02:17:13.570127987Z    4: std::panicking::rust_panic_with_hook

2019-11-15T02:17:13.570135833Z              at src/libstd/panicking.rs:478

2019-11-15T02:17:13.570143726Z    5: std::panicking::continue_panic_fmt

2019-11-15T02:17:13.570176715Z              at src/libstd/panicking.rs:385

2019-11-15T02:17:13.570205002Z    6: std::panicking::begin_panic_fmt

2019-11-15T02:17:13.570215521Z              at src/libstd/panicking.rs:340

2019-11-15T02:17:13.570222928Z    7: bitwarden_rs_ldap::main

2019-11-15T02:17:13.570267459Z    8: std::rt::lang_start::{{closure}}

2019-11-15T02:17:13.570278074Z    9: std::panicking::try::do_call

2019-11-15T02:17:13.570285261Z              at src/libstd/rt.rs:49

2019-11-15T02:17:13.570292264Z              at src/libstd/panicking.rs:297

2019-11-15T02:17:13.570315887Z   10: __rust_maybe_catch_panic

2019-11-15T02:17:13.570427953Z              at src/libpanic_unwind/lib.rs:92

2019-11-15T02:17:13.570440740Z   11: std::rt::lang_start_internal

2019-11-15T02:17:13.570448210Z              at src/libstd/panicking.rs:276

2019-11-15T02:17:13.570455214Z              at src/libstd/panic.rs:388

2019-11-15T02:17:13.570472186Z              at src/libstd/rt.rs:48

2019-11-15T02:17:13.570480283Z   12: main

2019-11-15T02:17:13.570487295Z   13: __libc_start_main
ViViDboarder commented 4 years ago

Yea. Make sure path in container matches the variable that you set.

trentnbauer commented 4 years ago

Hi mate, I tried this; docker run -d -v /config.toml:/mnt/nfs/synology/bitwardenldap/config.toml:ro vividboarder/bitwarden_rs_ldap and I'm still getting the "failed to open config.toml" error :(

ViViDboarder commented 4 years ago

You have your source and destination swapped. I'm assuming the file is actually sitting at /mnt/nfs/synology/bitwardenldap/config.toml. If so, you'll want to do:

docker run -d -v /mnt/nfs/synology/bitwardenldap/config.toml:/usr/src/bitwarden_rs_ldap/config.toml:ro vividboarder/bitwarden_rs_ldap