Connecting Spring Joints on collision

Hello, I found this Script on connecting spring joints on collision and it is working perfectly as needed except the default spring variable is set to “10” when I actually need it to be set to “100”

How can I set the spring variable to “100” when the two object collide ?

bool hasJoint;
 void OnCollisionEnter (Collision collision)
 {
     if (collision.gameObject.GetComponent<Rigidbody>() != null && !hasJoint) {
         gameObject.AddComponent<FixedJoint> ();  
         gameObject.GetComponent<FixedJoint>().connectedBody = collision.rigidbody;
         hasJoint = true;
     }
 } 

Thank you!

Old post but if anyone needs it…

First

SpringJoint joint = gameObject.AddComponent<SpringJoint>();

then

joint.spring = 100;

or

gameObject.GetComponent<SpringJoint>().spring =100;