Skip to content

Commit

Permalink
chore: Rename to famedly-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
emgrav committed Oct 30, 2024
1 parent 629df56 commit c8cffe6
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 244 deletions.
294 changes: 66 additions & 228 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "ldap-sync"
name = "famedly-sync"
version = "0.5.0"
authors = []
edition = "2021"
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ RUN cargo auditable build --release

FROM debian:bookworm-slim
RUN apt update && apt install ca-certificates curl -y
RUN mkdir -p /opt/famedly-sync-agent
WORKDIR /opt/famedly-sync-agent
COPY --from=builder /app/target/release/ldap-sync /usr/local/bin/famedly-sync-agent
ENV FAMEDLY_LDAP_SYNC_CONFIG="/opt/famedly-sync-agent/config.yaml"
ENTRYPOINT ["/usr/local/bin/famedly-sync-agent"]
RUN mkdir -p /opt/famedly-sync
WORKDIR /opt/famedly-sync
COPY --from=builder /app/target/release/famedly-sync /usr/local/bin/famedly-sync
ENV FAMEDLY_SYNC_CONFIG="/opt/famedly-sync/config.yaml"
ENTRYPOINT ["/usr/local/bin/famedly-sync"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Currently supported sources:

The tool expects a configuration file located at `./config.yaml`. See example configuration at [config.sample.yaml](./config.sample.yaml).

The default path can be changed by setting the new path to the environment variable `FAMEDLY_LDAP_SYNC_CONFIG`.
The default path can be changed by setting the new path to the environment variable `FAMEDLY_SYNC_CONFIG`.

Also, individual configuration items and the whole configuration can be set using environment variables. For example, the following YAML configuration:

Expand All @@ -24,10 +24,10 @@ sources:
Could be set using the following environment variable:
```bash
FAMEDLY_LDAP_SYNC__SOURCES__LDAP__URL="ldap://localhost:1389"
FAMEDLY_SYNC__SOURCES__LDAP__URL="ldap://localhost:1389"
```

Note that the environment variable name always starts with the prefix `FAMEDLY_LDAP_SYNC` followed by keys separated by double underscores (`__`).
Note that the environment variable name always starts with the prefix `FAMEDLY_SYNC` followed by keys separated by double underscores (`__`).

Some configuration items take a list of values. In this cases the values should be separated by space. **If an empty list is desired the variable shouldn't be created.**

Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
};

/// App prefix for env var configuration
const ENV_VAR_CONFIG_PREFIX: &str = "FAMEDLY_LDAP_SYNC";
const ENV_VAR_CONFIG_PREFIX: &str = "FAMEDLY_SYNC";
/// Separator for setting a list using env vars
const ENV_VAR_LIST_SEP: &str = " ";

Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::{path::Path, process::ExitCode, str::FromStr};

use anyhow::{Context, Result};
use ldap_sync::Config;
use famedly_sync::Config;
use tracing::level_filters::LevelFilter;

#[tokio::main]
Expand All @@ -20,7 +20,7 @@ async fn main() -> ExitCode {
#[allow(clippy::print_stderr)]
async fn run_sync() -> Result<()> {
let config = {
let config_path = std::env::var("FAMEDLY_LDAP_SYNC_CONFIG").unwrap_or("config.yaml".into());
let config_path = std::env::var("FAMEDLY_SYNC_CONFIG").unwrap_or("config.yaml".into());
let config_path = Path::new(&config_path);
match Config::new(config_path) {
Ok(config) => config,
Expand Down
2 changes: 1 addition & 1 deletion src/sources/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Source for CsvSource {
let new_users = self.read_csv()?;
// TODO: Implement changed and deleted users
// Holding off on this until we get rid of the cache concept
// https://github.com/famedly/ldap-sync/issues/53
// https://github.com/famedly/famedly-sync/issues/53
return Ok(SourceDiff { new_users, changed_users: vec![], deleted_user_ids: vec![] });
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use std::{collections::HashSet, path::Path, time::Duration};

use base64::prelude::{Engine, BASE64_STANDARD};
use ldap3::{Ldap as LdapClient, LdapConnAsync, LdapConnSettings, Mod};
use ldap_sync::{
use famedly_sync::{
csv_test_helpers::temp_csv_file,
ukt_test_helpers::{
get_mock_server_url, prepare_endpoint_mock, prepare_oauth2_mock, ENDPOINT_PATH, OAUTH2_PATH,
},
AttributeMapping, Config, FeatureFlag,
};
use ldap3::{Ldap as LdapClient, LdapConnAsync, LdapConnSettings, Mod};
use tempfile::TempDir;
use test_log::test;
use tokio::sync::OnceCell;
Expand Down
2 changes: 1 addition & 1 deletion tests/environment/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
read_only: true

test-setup:
image: famedly/ldap-sync-testenv
image: famedly/famedly-sync-testenv
build:
context: ./test-setup
entrypoint: /environment/test-setup.sh
Expand Down

0 comments on commit c8cffe6

Please sign in to comment.