-
Notifications
You must be signed in to change notification settings - Fork 28
docs: Update docs for enterprise #1138
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
Open
jrconlin
wants to merge
11
commits into
main
Choose a base branch
from
docs/PUSH-653_min_config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f790aea
docs: Update docs for enterprise
jrconlin 6b43468
f r's
jrconlin edcc1c7
f fix unwrap
jrconlin 1b8775a
f fix unit tests
jrconlin ebbe729
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin 1881bae
Merge branch 'master' into docs/PUSH-653_min_config
jrconlin ce11bc9
Merge branch 'master' of github.com:mozilla-services/autopush-rs into…
jrconlin dff89fb
f r's
jrconlin 4dcf8a3
Merge branch 'docs/PUSH-653_min_config' of github.com:mozilla-service…
jrconlin a5a7314
f fmt
jrconlin 5d223fb
f audit
jrconlin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -49,6 +49,8 @@ fn include_port(scheme: &str, port: u16) -> bool { | |
| /// The Applications settings, read from CLI, Environment or settings file, for the | ||
| /// autoconnect application. These are later converted to | ||
| /// [autoconnect::autoconnect-settings::AppState]. | ||
| /// Remember to update the [Sample Config](configs/autoconnect.toml.sample) file and | ||
| /// the [documentation](docs/src/config_options.md) when adding new settings. | ||
| #[derive(Clone, Debug, Deserialize)] | ||
| #[serde(default)] | ||
| pub struct Settings { | ||
|
|
@@ -78,7 +80,8 @@ pub struct Settings { | |
| /// The optional port override for the endpoint URL | ||
| pub endpoint_port: u16, | ||
| /// The seed key to use for endpoint encryption | ||
| pub crypto_key: String, | ||
| pub crypto_key: Option<String>, // obsolete, use `crypto_keys` instead | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment says obsolete?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is, but we want to persist the key to allow for older installs to not break suddenly. |
||
| pub crypto_keys: Option<String>, | ||
| /// The host name to send recorded metrics | ||
| pub statsd_host: Option<String>, | ||
| /// The port number to send recorded metrics | ||
|
|
@@ -144,7 +147,8 @@ impl Default for Settings { | |
| endpoint_scheme: "http".to_owned(), | ||
| endpoint_hostname: "localhost".to_owned(), | ||
| endpoint_port: 8082, | ||
| crypto_key: format!("[{}]", Fernet::generate_key()), | ||
| crypto_keys: Some(format!("[{}]", Fernet::generate_key())), | ||
| crypto_key: None, | ||
| statsd_host: Some("localhost".to_owned()), | ||
| // Matches the legacy value | ||
| statsd_label: "autoconnect".to_owned(), | ||
|
|
@@ -351,27 +355,34 @@ mod tests { | |
| fn test_default_settings() { | ||
| // Test that the Config works the way we expect it to. | ||
| use std::env; | ||
| let key: &str = "[mqCGb8D-N7mqx6iWJov9wm70Us6kA9veeXdb8QUuzLQ=]"; | ||
| let port = format!("{ENV_PREFIX}__PORT").to_uppercase(); | ||
| let msg_limit = format!("{ENV_PREFIX}__MSG_LIMIT").to_uppercase(); | ||
| let fernet = format!("{ENV_PREFIX}__CRYPTO_KEY").to_uppercase(); | ||
| let fernet = format!("{ENV_PREFIX}__CRYPTO_KEYS").to_uppercase(); | ||
| let old_fernet = format!("{ENV_PREFIX}__CRYPTO_KEY").to_uppercase(); | ||
|
|
||
| let v1 = env::var(&port); | ||
| let v2 = env::var(&msg_limit); | ||
| unsafe { | ||
| env::set_var(&port, "9123"); | ||
| env::set_var(&msg_limit, "123"); | ||
| env::set_var(&fernet, "[mqCGb8D-N7mqx6iWJov9wm70Us6kA9veeXdb8QUuzLQ=]"); | ||
| env::set_var(&fernet, key); | ||
| } | ||
| let settings = Settings::with_env_and_config_files(&Vec::new()).unwrap(); | ||
| assert_eq!(settings.endpoint_hostname, "localhost".to_owned()); | ||
| assert_eq!(&settings.port, &9123); | ||
| assert_eq!(&settings.msg_limit, &123); | ||
| assert_eq!( | ||
| &settings.crypto_key, | ||
| "[mqCGb8D-N7mqx6iWJov9wm70Us6kA9veeXdb8QUuzLQ=]" | ||
| ); | ||
| assert_eq!(&settings.crypto_keys, &Some(key.to_owned())); | ||
| assert_eq!(settings.open_handshake_timeout, Duration::from_secs(5)); | ||
|
|
||
| // Ensure that the old `CRYPTO_KEY` env var is still supported for backwards | ||
| // compatibility. | ||
| unsafe { | ||
| env::set_var(&old_fernet, key); | ||
| } | ||
| let settings = Settings::with_env_and_config_files(&Vec::new()).unwrap(); | ||
| assert_eq!(&settings.crypto_keys, &Some(key.to_owned())); | ||
|
|
||
|
jrconlin marked this conversation as resolved.
Outdated
|
||
| // reset (just in case) | ||
| if let Ok(p) = v1 { | ||
| trace!("Resetting {}", &port); | ||
|
|
||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment here, why starting with [ is invalid, what is this magic [?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to be consistent with autoendpoint's usage. The
[]imply a mock JSON "list" definition indicating multiple keys