···1-use std::env;
2-#[derive(Debug, Clone)]
3-/// Configuration values for a Feed service
4-pub struct Config {
5- /// Your account's decentralized identifier (DID)
6- /// A DID is a persistent, long-term identifier for every account. Usually look like did:plc:ewvi7nxzyoun6zhxrhs64oiz.
7- pub publisher_did: String,
8- /// The host name for your feed generator.
9- ///
10- /// For example: if github were to host a feed generator service at their domain they would set this value to `github.com`
11- ///
12- /// You can develop your feed locally without setting this to a real value. However, when publishing, this value must be a domain that:
13- /// - Points to your service.
14- /// - Is secured with SSL (HTTPS).
15- /// - Is accessible on the public internet.
16- pub feed_generator_hostname: String,
17-}
18-19-impl Config {
20- /// Loads the config from a local .env file containing these variables
21- /// PUBLISHER_DID
22- /// FEED_GENERATOR_HOSTNAME
23- pub fn load_env_config() -> Self {
24- Config {
25- publisher_did: env::var("PUBLISHER_DID")
26- .expect(".env file is missing an entry for PUBLISHER_DID"),
27- feed_generator_hostname: env::var("FEED_GENERATOR_HOSTNAME")
28- .expect(".env file is missing an entry for FEED_GENERATOR_HOSTNAME"),
29- }
30- }
31-}