-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
AGENT_ISSUANCE_CREDENTIAL_LOGO_URL
and test
feature flag (
#11) * feat: make startup commands segregated * refactor: reuse `startup_commands` in `agent_api_rest` unit tests * feat: accept host url in `startup_commands` * feat: support credential logo url * fix: remove temp test * feat: add `test` feature to `agent_shared` to allow for testing across agents * test: use the `agent_shared` `test` feature * fix: fix test feature settings for `fn config` * fix: remove * fix: make optional * fix: typo
- Loading branch information
1 parent
c090a5b
commit 0015888
Showing
10 changed files
with
96 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
AGENT_CONFIG_LOG_FORMAT=json | ||
AGENT_CONFIG_EVENT_STORE=postgres | ||
AGENT_APPLICATION_HOST=my-domain.example.org | ||
AGENT_ISSUANCE_CREDENTIAL_NAME="Demo Credential" | ||
AGENT_ISSUANCE_CREDENTIAL_LOGO_URL=https://my-domain.example.org/credential_logo.png | ||
AGENT_STORE_DB_CONNECTION_STRING=postgresql://demo_user:demo_pass@localhost:5432/demo |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
use tracing::info; | ||
|
||
/// Read environment variables | ||
#[allow(unused)] | ||
pub fn config(package_name: &str) -> config::Config { | ||
// Load global .env file | ||
dotenvy::dotenv().ok(); | ||
#[cfg(feature = "test")] | ||
let config = test_config(); | ||
|
||
// Build configuration | ||
let config = config::Config::builder() | ||
.add_source(config::Environment::with_prefix(package_name)) | ||
.add_source(config::Environment::with_prefix("AGENT_CONFIG")) | ||
.build() | ||
.unwrap(); | ||
#[cfg(not(feature = "test"))] | ||
let config = { | ||
dotenvy::dotenv().ok(); | ||
|
||
config::Config::builder() | ||
.add_source(config::Environment::with_prefix(package_name)) | ||
.add_source(config::Environment::with_prefix("AGENT_CONFIG")) | ||
.build() | ||
.unwrap() | ||
}; | ||
|
||
info!("{:?}", config); | ||
|
||
config | ||
} | ||
|
||
/// Read environment variables for tests that can be used across packages | ||
#[cfg(feature = "test")] | ||
fn test_config() -> config::Config { | ||
dotenvy::from_filename("agent_shared/tests/.env.test").ok(); | ||
|
||
config::Config::builder() | ||
.add_source(config::Environment::with_prefix("TEST")) | ||
.add_source(config::Environment::with_prefix("AGENT_CONFIG")) | ||
.build() | ||
.unwrap() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
AGENT_SHARED_VARIABLE=env_value | ||
TEST_VARIABLE=env_value | ||
AGENT_CONFIG_GLOBAL_VARIABLE=global_env_value | ||
AGENT_OTHER_OTHER_VARIABLE=other_env_value | ||
TEST_CREDENTIAL_NAME="Demo Credential" | ||
TEST_CREDENTIAL_LOGO_URL=https://my-domain.example.org/credential_logo.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters