···11-use std::env;
22-#[derive(Debug, Clone)]
33-/// Configuration values for a Feed service
44-pub struct Config {
55- /// Your account's decentralized identifier (DID)
66- /// A DID is a persistent, long-term identifier for every account. Usually look like did:plc:ewvi7nxzyoun6zhxrhs64oiz.
77- pub publisher_did: String,
88- /// The host name for your feed generator.
99- ///
1010- /// For example: if github were to host a feed generator service at their domain they would set this value to `github.com`
1111- ///
1212- /// You can develop your feed locally without setting this to a real value. However, when publishing, this value must be a domain that:
1313- /// - Points to your service.
1414- /// - Is secured with SSL (HTTPS).
1515- /// - Is accessible on the public internet.
1616- pub feed_generator_hostname: String,
1717-}
1818-1919-impl Config {
2020- /// Loads the config from a local .env file containing these variables
2121- /// PUBLISHER_DID
2222- /// FEED_GENERATOR_HOSTNAME
2323- pub fn load_env_config() -> Self {
2424- Config {
2525- publisher_did: env::var("PUBLISHER_DID")
2626- .expect(".env file is missing an entry for PUBLISHER_DID"),
2727- feed_generator_hostname: env::var("FEED_GENERATOR_HOSTNAME")
2828- .expect(".env file is missing an entry for FEED_GENERATOR_HOSTNAME"),
2929- }
3030- }
3131-}