 
 	fileprivate static var shared			: SentrySDK?
 
-	fileprivate static let plistSentryDsn	= "SentryDsn"
-
-	fileprivate static let isDebugBuild		: Bool = {
-		#if DEBUG
-		return true
-		#else
-		return false
-		#endif
-	}()
-
-	fileprivate static let environment		: String = {
-		#if ALPHA
-		return "alpha"
-		#endif
-
-		#if BETA
-		return "beta"
-		#endif
-
-		#if LIVE
-		return "live"
-		#endif
-	}()
-
 	// MARK: - Private properties
 
-	fileprivate var isInitialized			= false
+	fileprivate var isInitialized					= false
 
 	// MARK: - Public properties
 

	///
	/// - Parameters:
	///   - configuration: sentry dsn string
	static func setup(sentryDsn: String? = nil) {

		// Get the Sentry dsn
		let idFromPlist = Bundle.main.object(forInfoDictionaryKey: SentrySDK.plistSentryDsn) as? String

		guard let _sentryDsn = (sentryDsn ?? idFromPlist) else {
			assertionFailure("Error: You have to set the `\(SentrySDK.plistSentryDsn)` key in the info plist.")
			return
		}

		// Make sure SentrySDK is not setup in a debug build
		guard (self.isDebugBuild == false) else {
			// Configure SentrySDK only for non debug builds or if the exception flag is set to true
			return
		}

		let instance = (self.shared ?? SentrySDK())

		do {
			Client.shared = try Client(dsn: _sentryDsn)
			Client.shared?.beforeSerializeEvent = { (event: Event) in
				event.environment = self.environment
			}

			try Client.shared?.startCrashHandler()

		fatalError("This is a test crash to trigger a crash report in Sentry Dashboard")
	}
}

extension SentrySDK {

	struct Configuration {
		fileprivate static let plistSentryDsn	= "SentryDsn"

		fileprivate static let isDebugBuild		: Bool = {
			#if DEBUG
			return true
			#else
			return false
			#endif
		}()

		fileprivate static let environment		: String = {
			#if ALPHA
			return "alpha"
			#endif

			#if BETA
			return "beta"
			#endif

			#if LIVE
			return "live"
			#endif
		}()

		fileprivate var sentryDSN			: String	= ""
		fileprivate var enableSMFLogUpload	: Bool		= true
		fileprivate var enableBreadcrumbs	: Bool		= true
		fileprivate var smfLogUploadMaxSize	: Int		= 5000

		/// Initializes a SentrySDK Configuration
		///
		///	- Parameters:
		///		- sentryDSN: supply this manually if you dont want it in the info.plist
		///		- enableSMFLogUpload: true if you want the SMFLogger logs to be submitted with a crash
		///		- enableBreadcrumbs: true if you want Sentry to attach the last user interaction before a crash
		///		- smfLogUploadMaxSize: The max count of characters which should be uploaded
		init(sentryDSN: String? = nil, enableSMFLogUpload: Bool = true, smfLogUploadMaxSize: Int = 5000, smfEnableBreadcrumbs: Bool = true) {

			// Get the Sentry DSN
			let dsnFromPlist = Bundle.main.object(forInfoDictionaryKey: SentrySDK.Configuration.plistSentryDsn) as? String

			guard let _sentryDsn = (sentryDSN ?? dsnFromPlist) else {
				assertionFailure("Error: You have to set the `\(SentrySDK.Configuration.plistSentryDsn)` key in the info plist or specify your own when initializing teh SDK.")
				return
			}

			self.sentryDSN				= _sentryDsn
			self.enableBreadcrumbs		= smfEnableBreadcrumbs
			self.enableSMFLogUpload		= enableSMFLogUpload
			self.smfLogUploadMaxSize	= smfLogUploadMaxSize
		}

		static var `default`: SentrySDK.Configuration {
			return Configuration()
		}
	}
}
