Skip to content

Commit

Permalink
fix config
Browse files Browse the repository at this point in the history
  • Loading branch information
Natoandro committed Jul 2, 2024
1 parent 438438b commit cc4ab79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Empty file.
2 changes: 1 addition & 1 deletion typegate/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function transformSyncConfig(raw: SyncConfig): SyncConfigX {
};

const s3 = {
endpoint: raw.s3_host.origin,
endpoint: raw.s3_host.href,
region: raw.s3_region,
credentials: {
accessKeyId: raw.s3_access_key,
Expand Down
16 changes: 10 additions & 6 deletions typegate/tests/e2e/upgrade/upgrade_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const syncEnvs = {
SYNC_S3_ACCESS_KEY: "minio",
SYNC_S3_SECRET_KEY: "password",
SYNC_S3_BUCKET: "upgrade-test",
SYNC_PATH_STYLE: "true",
};

const syncConfig = transformSyncConfig({
Expand All @@ -55,17 +56,20 @@ const disabled = [
"metagen-py.ts",
];

async function checkMetaBin(path: typeof tempDir) {
async function checkMetaBin(path: typeof tempDir, version: string) {
try {
if (!(await path.exists())) {
return false;
}
const res = await $`bash -c 'meta --version'`
.env("PATH", `${path.parent()!.toString()}:${Deno.env.get("PATH")}`)
.stdout("piped");
console.log(res.stdout);
return true;
} catch (_e) {
if (res.stdout.includes(version)) {
return true;
}
throw new Error(`version mismatch: ${res.stdout}`);
} catch (e) {
console.error(e);
return false;
}
}
Expand All @@ -75,7 +79,7 @@ async function downloadAndExtractAsset(version: string) {
const name = getAssetName(version);
const extractTargetDir = tempDir.join(name);
const metaBin = extractTargetDir.join("meta");
if (await checkMetaBin(metaBin)) {
if (await checkMetaBin(metaBin, version)) {
return metaBin.toString();
}
const url =
Expand Down Expand Up @@ -109,7 +113,7 @@ async function downloadAndExtractAsset(version: string) {

await Deno.remove(archivePath.toString());

if (!(await checkMetaBin(metaBin))) {
if (!(await checkMetaBin(metaBin, version))) {
throw new Error("unexpected");
}
return metaBin.toString();
Expand Down

0 comments on commit cc4ab79

Please sign in to comment.