lib/buildbox/configuration.rb in buildbox-0.4 vs lib/buildbox/configuration.rb in buildbox-0.4.1
- old
+ new
@@ -16,10 +16,19 @@
def api_key
ENV['BUILDBOX_API_KEY'] || self[:api_key]
end
def api_endpoint
- ENV['BUILDBOX_API_ENDPOINT'] || self[:api_endpoint] || "https://agent.buildbox.io/v1"
+ endpoint = ENV['BUILDBOX_API_ENDPOINT'] || self[:api_endpoint] || "https://agent.buildbox.io/v1"
+
+ # hack to update legacy endpoints
+ if endpoint == "https://api.buildbox.io/v1"
+ self.api_endpoint = "https://agent.buildbox.io/v1"
+ save
+ api_endpoint
+ else
+ endpoint
+ end
end
def update(attributes)
attributes.each_pair { |key, value| self[key] = value }
save