 _           = require 'lodash'
 GitlabAPI   = require 'gitlab'
 KodingError = require '../../error'
+KONFIG      = require 'koding-config-manager'
+
+
 getPrivateToken = (options, callback) ->
 
   { urlData: { baseUrl }, token } = options


module.exports = GitLabProvider =

  importStackTemplateData: (importParams, user, callback) ->

    { url, privateToken } = importParams


    if privateToken
      @importStackTemplateWithPrivateToken privateToken, urlData, callback
    else if oauth = user.getAt 'foreignAuth.gitlab'
      @importStackTemplateWithOauth oauth, urlData, callback
    else
      @importStackTemplateWithRawUrl urlData, callback

