예제 #1
0
 private static void Initialize(out Config config, out GoogleOAuthFlow.ApplicationOAuthConfiguration applicationOAuthConfiguration)
 {
     config = ReadConfig();
     applicationOAuthConfiguration = new GoogleOAuthFlow.ApplicationOAuthConfiguration
     {
         ClientID     = config.ClientID,
         ClientSecret = config.ClientSecret,
         ApplicationDefaultCredentialsFile = ApplicationDefaultCredentialsFile
     };
 }
예제 #2
0
        private static async Task <int> DownsyncWithAuthentication(Config config, GoogleOAuthFlow.ApplicationOAuthConfiguration applicationOAuthConfiguration, string folder, string package)
        {
            if (((string)config.BlockStorageURI).StartsWith("gs://"))
            {
                await GoogleOAuthFlow.RefreshUserApplicationDefaultCredentials(applicationOAuthConfiguration);

                if (!await Longtail.DownsyncFromGSBucket(applicationOAuthConfiguration.ApplicationDefaultCredentialsFile, config.BlockStorageURI, folder, PackageNameToURI(config.VersionIndexStorageURI, package)))
                {
                    Console.WriteLine("Untar operation failed.");
                    return(1);
                }
            }
            else
            {
                if (!await Longtail.DownsyncFromLocalStore(config.BlockStorageURI, folder, PackageNameToURI(config.VersionIndexStorageURI, package)))
                {
                    Console.WriteLine("Untar operation failed.");
                    return(1);
                }
            }

            return(0);
        }