Is there a way to read the in the buildscript closure?

I have a subproject that has a buildscript that does the following:

project.buildscript { scriptHandler ->
    // configure the repositories
    apply from: "${rootDir}/gradle/repositories.gradle", to: scriptHandler

the repositories.gradle file has a variable in it similiar to the following:

def contextUrl = hasProperty('contextUrl') ?
                              contextUrl :

The defaultContextUrl is located in the root projects file. When I try to do a clean I get the following error:

No such property: defaultContextUrl for class: org.gradle.api.internal.initialization.DefaultScriptHandler

I would like to make the variable configurable