Skip to content

Commit

Permalink
Documentations edited
Browse files Browse the repository at this point in the history
Signed-off-by: Mert Can Bilgiç <mert.bilgic@trendyol.com>
  • Loading branch information
gmzsenturk authored and mertcb committed Mar 3, 2021
1 parent 2ebfe29 commit a10174b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ techdocs:
generators:
techdocs: 'docker' # Alternatives - 'local'
publisher:
type: 'local' # Alternatives - 'googleGcs' or 'awsS3' or 'azureBlobStorage' or 'openStackSwift' Read documentation for using alternatives.
type: 'local' # Alternatives - 'googleGcs' or 'awsS3' or 'azureBlobStorage' or 'openStackSwift'. Read documentation for using alternatives.

sentry:
organization: my-company
Expand Down
17 changes: 8 additions & 9 deletions docs/features/techdocs/using-cloud-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,11 @@ techdocs:

**3b. Authentication using app-config.yaml**

If you do not prefer (3a) and optionally like to use a service account, you can Set the config `techdocs.publisher.azureBlobStorage.credentials.accountName` in
follow these steps. your `app-config.yaml` to the your account name.
If you do not prefer (3a) and optionally like to use a service account, you can
follow these steps.

To get credentials, access the Azure Portal and go to "Settings > Access Keys",
and get your Storage account name and Primary Key.

https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key
for more details.

Expand Down Expand Up @@ -373,14 +372,14 @@ techdocs:
$env: OPENSTACK_SWIFT_STORAGE_DOMAIN_ID
domainName:
$env: OPENSTACK_SWIFT_STORAGE_DOMAIN_NAME
region:
region:
$env: OPENSTACK_SWIFT_STORAGE_REGION
```

**4. That's it!**

Your Backstage app is now ready to use OpenStack Swift Storage for TechDocs, to store
and read the static generated documentation files. When you start the backend of
the app, you should be able to see
`techdocs info Successfully connected to the OpenStack Swift Storage container` in
the logs.
Your Backstage app is now ready to use OpenStack Swift Storage for TechDocs, to
store and read the static generated documentation files. When you start the
backend of the app, you should be able to see
`techdocs info Successfully connected to the OpenStack Swift Storage container`
in the logs.
2 changes: 1 addition & 1 deletion packages/techdocs-common/__mocks__/pkgcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { EventEmitter } from 'events';
const rootDir = os.platform() === 'win32' ? 'C:\\rootDir' : '/rootDir';

const checkFileExists = async (Key: string): Promise<boolean> => {
// Key will always have / as file separator irrespective of OS since S3 expects /.
// Key will always have / as file separator irrespective of OS since cloud providers expects /.
// Normalize Key to OS specific path before checking if file exists.
const filePath = path.join(rootDir, Key);

Expand Down
23 changes: 12 additions & 11 deletions packages/techdocs-common/src/stages/publish/openStackSwift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class OpenStackSwiftPublish implements PublisherBase {
} catch (error) {
throw new Error(
"Since techdocs.publisher.type is set to 'openStackSwift' in your app config, " +
'techdocs.publisher.openStackSwift.containerName is required.',
'techdocs.publisher.openStackSwift.containerName is required.',
);
}

Expand Down Expand Up @@ -80,9 +80,9 @@ export class OpenStackSwiftPublish implements PublisherBase {
} else {
logger.error(
`Could not retrieve metadata about the OpenStack Swift container ${containerName}. ` +
'Make sure the container exists. Also make sure that authentication is setup either by ' +
'explicitly defining credentials and region in techdocs.publisher.openStackSwift in app config or ' +
'by using environment variables. Refer to https://backstage.io/docs/features/techdocs/using-cloud-storage',
'Make sure the container exists. Also make sure that authentication is setup either by ' +
'explicitly defining credentials and region in techdocs.publisher.openStackSwift in app config or ' +
'by using environment variables. Refer to https://backstage.io/docs/features/techdocs/using-cloud-storage',
);

logger.error(`from OpenStack client library: ${err.message}`);
Expand Down Expand Up @@ -138,16 +138,17 @@ export class OpenStackSwiftPublish implements PublisherBase {
};

// Rate limit the concurrent execution of file uploads to batches of 10 (per publish)
const uploadFile = limiter(() =>
new Promise((res, rej) => {
const writeStream = this.storageClient.upload(params);
const uploadFile = limiter(
() =>
new Promise((res, rej) => {
const writeStream = this.storageClient.upload(params);

writeStream.on('error', rej);
writeStream.on('error', rej);

writeStream.on('success', res);
writeStream.on('success', res);

readStream.pipe(writeStream);
}),
readStream.pipe(writeStream);
}),
);
uploadPromises.push(uploadFile);
}
Expand Down

0 comments on commit a10174b

Please sign in to comment.