Esempio n. 1
0
        /// <summary>Wraps a call to the secrets manager, and queries the user for a value, if one
        /// isn't already on record.</summary>
        /// <param name="id">The secret's ID.</param>
        /// <param name="prompt">The string with which to ask the user for a value.</param>
        /// <param name="value">When this returns, contains the secret; or the null or empty string
        /// if the retrieval failed.</param>
        /// <returns>True if the retrieval or prompt succeeded; otherwise, false.</returns>
        private static bool GetSecret(string id, string prompt, out string value)
        {
            if (SecretsManager.TryGet(id, out value) &&
                !string.IsNullOrWhiteSpace(value))
            {
                return(true);
            }

            Console.Write(prompt + " ");
            value = Console.ReadLine();
            value = value.Trim();

            return(!string.IsNullOrEmpty(value));
        }