Description
Note: The information bellow is outdated. See #101 (comment) for recent information.
Copied from parent issue #100
By default, ember new app-name
will create an app with ember-cli-content-security-policy
as a dependency. The default app settings will prevent the application from running cause the application to throw errors due to several of the default content security policies being violated. The app will still run, but the console will be red.
The following settings are required to be present in the app's configuration file into the exported ENV
object in order for the app to run without issues:
contentSecurityPolicyHeader: 'Content-Security-Policy',
contentSecurityPolicy: {
'default-src': "'self' accounts.google.com content.googleapis.com drive.google.com",
'script-src': "'self' 'unsafe-eval' 'unsafe-inline' apis.google.com drive.google.com",
'font-src': "'self'",
'connect-src': "'self' 'unsafe-eval' apis.google.com drive.google.com",
'img-src': "'self' data: ssl.gstatic.com csi.gstatic.com",
'style-src': "'self' 'unsafe-inline'",
'media-src': "'self'"
},
Potential solution
- We could keep things as they are. Errors are thrown for each of these settings, so the user will be aware what's wrong for the most part. However, the minimal required settings are identical for any app using ember-gdrive, so ideally, we should find an automatic solution which wouldn't require user intervention.
- The
Blueprint.prototype
(used to define a blueprint) has aninsertIntoFile()
method, which should be able to insert something into any file within the project folder, including the configuration file. - Maybe there's a more robust method somewhere which allows adding actual configuration properties to the configuration file. This would be preferable to number 2, but I'm not sure it actual exists.
Addon.prototype.config
could be our answer here, in which case, the configuration properties would be added toindex.js
, instead of through a prototype.
Conclusion
I believe this configuration setting group can and should be automated. I could spend some time trying to find out if option 3 is possible, but if not, option 2 is the way to go in my opinion.