Add dockerfile (#32)
This commit is contained in:
parent
5751463942
commit
9c8d426184
3 changed files with 25 additions and 6 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
./target
|
12
Dockerfile
Normal file
12
Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
# no point in tagging the rust version, currently using nightly
|
||||
FROM rust:slim-buster
|
||||
|
||||
RUN apt update && apt -y install libssl-dev libpq-dev pkg-config make
|
||||
RUN rustup default nightly
|
||||
|
||||
WORKDIR /atuin
|
||||
COPY . /atuin
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
ENTRYPOINT ["/atuin/target/release/atuin"]
|
|
@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
|
|||
|
||||
use chrono::prelude::*;
|
||||
use chrono::Utc;
|
||||
use config::{Config, File as ConfigFile};
|
||||
use config::{Config, Environment, File as ConfigFile};
|
||||
use directories::ProjectDirs;
|
||||
use eyre::{eyre, Result};
|
||||
use parse_duration::parse;
|
||||
|
@ -94,10 +94,14 @@ impl Settings {
|
|||
|
||||
create_dir_all(config_dir)?;
|
||||
|
||||
let config_file = if let Ok(p) = std::env::var("ATUIN_CONFIG") {
|
||||
PathBuf::from(p)
|
||||
} else {
|
||||
let mut config_file = PathBuf::new();
|
||||
config_file.push(config_dir);
|
||||
config_file.push("config.toml");
|
||||
let config_file = config_file.as_path();
|
||||
config_file
|
||||
};
|
||||
|
||||
// create the config file if it does not exist
|
||||
|
||||
|
@ -129,7 +133,7 @@ impl Settings {
|
|||
s.set_default("server.host", "127.0.0.1")?;
|
||||
s.set_default("server.port", 8888)?;
|
||||
s.set_default("server.open_registration", false)?;
|
||||
s.set_default("server.db_uri", "please set a postgres url")?;
|
||||
s.set_default("server.db_uri", "DEFAULT POSTGRES URI, PLEASE CHANGE")?;
|
||||
|
||||
if config_file.exists() {
|
||||
s.merge(ConfigFile::with_name(config_file.to_str().unwrap()))?;
|
||||
|
@ -139,6 +143,8 @@ impl Settings {
|
|||
file.write_all(example_config)?;
|
||||
}
|
||||
|
||||
s.merge(Environment::with_prefix("atuin").separator("_"))?;
|
||||
|
||||
// all paths should be expanded
|
||||
let db_path = s.get_str("local.db_path")?;
|
||||
let db_path = shellexpand::full(db_path.as_str())?;
|
||||
|
|
Loading…
Reference in a new issue