Skip to content

Commit

Permalink
add provider google to test case
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Aug 18, 2023
1 parent 565d813 commit 391e720
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main-5.4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ jobs:
S3_WASABI_SECRET_KEY: ${{ secrets.S3_WASABI_SECRET_KEY }}
S3_WASABI_HOST: s3.eu-central-1.wasabisys.com
S3_WASABI_BUCKET_PREFIX: lucee-ldev-e-
S3_GOOGLE_ACCESS_KEY_ID: ${{ secrets.S3_GOOGLE_ACCESS_KEY_ID }}
S3_GOOGLE_SECRET_KEY: ${{ secrets.S3_GOOGLE_SECRET_KEY }}
S3_GOOGLE_HOST: storage.googleapis.com
S3_GOOGLE_BUCKET_PREFIX: lucee-ldev-e-
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ jobs:
S3_WASABI_SECRET_KEY: ${{ secrets.S3_WASABI_SECRET_KEY }}
S3_WASABI_HOST: s3.eu-central-1.wasabisys.com
S3_WASABI_BUCKET_PREFIX: lucee-ldev-e-
S3_GOOGLE_ACCESS_KEY_ID: ${{ secrets.S3_GOOGLE_ACCESS_KEY_ID }}
S3_GOOGLE_SECRET_KEY: ${{ secrets.S3_GOOGLE_SECRET_KEY }}
S3_GOOGLE_HOST: storage.googleapis.com
S3_GOOGLE_BUCKET_PREFIX: lucee-ldev-e-
4 changes: 4 additions & 0 deletions tests/functions/S3Copy.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {

it(title="check region with wasabi",skip=Util::isWasabiNotSupported(), body = function( currentSpec ) {
testit(Util::getWasabiCredentials(),"eu-central-1");
});

it(title="check region with google",skip=Util::isGoogleNotSupported(), body = function( currentSpec ) {
testit(Util::getGoogleCredentials(),"us-east-1");
});

});
Expand Down
38 changes: 38 additions & 0 deletions tests/functions/Util.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,43 @@ component {

return {ACCESS_KEY_ID:ACCESS_KEY_ID,SECRET_KEY:SECRET_KEY,HOST:HOST,PREFIX:PREFIX};
}
public static boolean function isWasabiNotSupported() {
res= getWasabiCredentials();
return isNull(res) || len(res)==0;
}
public static struct function getWasabiCredentials() {
var ACCESS_KEY_ID=server.system.environment.S3_WASABI_ACCESS_KEY_ID?:nullValue();
if(isNull(ACCESS_KEY_ID) || isEmpty(ACCESS_KEY_ID)) return {};

var SECRET_KEY=server.system.environment.S3_WASABI_SECRET_KEY?:nullValue();
if(isNull(SECRET_KEY) || isEmpty(SECRET_KEY)) return {};

var HOST=server.system.environment.S3_WASABI_HOST?:nullValue();
if(isNull(HOST) || isEmpty(HOST)) return {};

var PREFIX=server.system.environment.S3_WASABI_BUCKET_PREFIX?:nullValue();
if(isNull(PREFIX) || isEmpty(PREFIX)) return {};

return {ACCESS_KEY_ID:ACCESS_KEY_ID,SECRET_KEY:SECRET_KEY,HOST:HOST,PREFIX:PREFIX};
}
public static boolean function isGoogleNotSupported() {
res= getGoogleCredentials();
return isNull(res) || len(res)==0;
}
public static struct function getGoogleCredentials() {
var ACCESS_KEY_ID=server.system.environment.S3_GOOGLE_ACCESS_KEY_ID?:nullValue();
if(isNull(ACCESS_KEY_ID) || isEmpty(ACCESS_KEY_ID)) return {};

var SECRET_KEY=server.system.environment.S3_GOOGLE_SECRET_KEY?:nullValue();
if(isNull(SECRET_KEY) || isEmpty(SECRET_KEY)) return {};

var HOST=server.system.environment.S3_GOOGLE_HOST?:nullValue();
if(isNull(HOST) || isEmpty(HOST)) return {};

var PREFIX=server.system.environment.S3_GOOGLE_BUCKET_PREFIX?:nullValue();
if(isNull(PREFIX) || isEmpty(PREFIX)) return {};

return {ACCESS_KEY_ID:ACCESS_KEY_ID,SECRET_KEY:SECRET_KEY,HOST:HOST,PREFIX:PREFIX};
}

}

0 comments on commit 391e720

Please sign in to comment.