Skip to main content

Google Bucket

Google Cloud Service provides file storage in Buckets. When you enable and synchronize the plugin, it will enable you to get the URL of all files stored in the bucket to use in your applicaiton. This is useful when you have a large amount of static assets, need to orginize your static assets in a folder structure or easily need to replace static assets during the developen of the application.

Note that the bucket must be public to internet in order to get the Dynamaker application to work.

1. Google Cloud Service Account

A. Create a bucket

Create a bucket: https://cloud.google.com/storage/docs/buckets
Remember to make your Bucket public to internet

B. Set CORS policy for bucket:

Find information here: https://cloud.google.com/storage/docs/using-cors
Example-policy:

[
{
"origin": ["https://app.dynamaker.com", "https://deployed.dynamaker.com"],
"method": ["GET"],
"responseHeader": ["Content-Type"],
"maxAgeSeconds": 3600
}
]

C. Create service account

Create a service account to use when connecting the application to the Bucket.
Read more about it here: https://cloud.google.com/iam/docs/service-accounts-create.
You will recieve a json-file containing the account key, make sure to keep this safe!


2. DynaMaker Plugin

A. Enable Plugin

Once you have your account key:

  • Go to your app dashboard, under Plugins, look for the plugin Google Bucket.
  • Fill in the name of your bucket, paste the account key you got from Google, enable the plugin and save.
  • Press Synchronize to synchronize your application to your Bucket

B. Use Plugin

  • Go to a Component Container of your app.
  • Import PLUGINS in edit/hide imports... at the top of the code editor as if it's a component.

Example on how to use a file stored in a Bucket to create a geometryGroup:

  generateGeometry() {
const geometryGroup = new SKYCAD.GeometryGroup()
const url = PLUGINS.GOOGLE_STATIC.getUrl('Table.glb')
const model = new SKYCAD.MeshModel(url)
geometryGroup.addGeometry(model, { scale: 1000 })

return geometryGroup
}