README.md in nightcrawler_swift-0.5.0 vs README.md in nightcrawler_swift-0.6.0
- old
+ new
@@ -39,20 +39,43 @@
config.nightcrawler_swift.username = "my_username1"
config.nightcrawler_swift.password = "my_password1"
config.nightcrawler_swift.auth_url = "https://auth.url.com:123/v2.0/tokens"
```
+The __password__ option can be left blank and be defined by the env variable __NSWIFT_PASSWORD__. The env variable will take precedence if the option was set.
+
__Optional configurations:__
```ruby
config.nightcrawler_swift.max_age = 3600 # default: nil
-config.nightcrawler_swift.verify_ssl = true # default: false
config.nightcrawler_swift.timeout = 10 # in seconds, default: nil
-config.nightcrawler_swift.admin_url = "https://api.host.com/v1/AUTH_1234" # default: uses the admin_url returned by authentication
-config.nightcrawler_swift.public_url = "http://asset.host.com/v1/AUTH_1234" # default: uses the public_url returned by authentication
-config.nightcrawler_swift.retries = 3 # default: 5, to disable set it to false
-config.nightcrawler_swift.max_retry_time = 64 # in seconds, default: 30
+
+# default: uses the admin_url returned by authentication
+config.nightcrawler_swift.admin_url = "https://api.host.com/v1/AUTH_1234"
+
+# default: uses the public_url returned by authentication
+config.nightcrawler_swift.public_url = "http://asset.host.com/v1/AUTH_1234"
+
+# default: 5, to disable set it to false
+config.nightcrawler_swift.retries = 3
+
+# in seconds, default: 30
+config.nightcrawler_swift.max_retry_time = 64
+
+# default: false. You could use OpenSSL::SSL::VERIFY_PEER
+config.nightcrawler_swift.verify_ssl = true
+
+# default: nil
+config.nightcrawler_swift.ssl_client_cert =
+ OpenSSL::X509::Certificate.new(File.read("cert.pem"))
+
+# default: nil
+config.nightcrawler_swift.ssl_client_key =
+ OpenSSL::PKey::RSA.new(File.read("key.pem"), "passphrase, if any")
+
+# default: nil
+config.nightcrawler_swift.ssl_ca_file = "ca_certificate.pem"
```
By default it will use ```Rails.logger``` as logger, to change that use a different logger in configurations, like:
```ruby
@@ -93,20 +116,44 @@
password: "my_password1",
auth_url: "https://auth.url.com:123/v2.0/tokens"
})
```
+The __password__ option can be left blank and be defined by the env variable __NSWIFT_PASSWORD__. The env variable will take precedence if the option was set.
+
+
__Optional configurations:__
```ruby
max_age: 3600,
-verify_ssl: true,
timeout: 10, # in seconds
-admin_url: "https://api.host.com/v1/AUTH_1234", # default: uses the admin_url returned by authentication
-public_url: "http://asset.host.com/v1/AUTH_1234", # default: uses the public_url returned by authentication
-retries: 3, # default: 5, to disable set it to false
-max_retry_time: 64 # in seconds, default: 30
+
+# default: uses the admin_url returned by authentication
+admin_url: "https://api.host.com/v1/AUTH_1234",
+
+# default: uses the public_url returned by authentication
+public_url: "http://asset.host.com/v1/AUTH_1234",
+
+# default: 5, to disable set it to false
+retries: 3,
+
+# in seconds, default: 30
+max_retry_time: 64
+
+# default: false. You could use OpenSSL::SSL::VERIFY_PEER
+verify_ssl: true,
+
+# default: nil
+ssl_client_cert:
+ OpenSSL::X509::Certificate.new(File.read("cert.pem")),
+
+# default: nil
+ssl_client_key:
+ OpenSSL::PKey::RSA.new(File.read("key.pem"), "passphrase, if any"),
+
+# default: nil
+ssl_ca_file: "ca_certificate.pem"
```
By default it will use ```Logger.new(STDOUT)``` as logger, to change that use:
```ruby
@@ -147,11 +194,18 @@
$ nswift list
```
```sh
$ nswift upload <real_path> <swift_path> # nswift upload robots.txt assets/robots.txt
```
+
+Upload also supports a custom max-age, to override the value defined in ".nswiftrc", example:
+
```sh
+$ nswift upload <real_path> <swift_path> --max-age VALUE # nswift upload readme assets/readme.md --max-age 300
+```
+
+```sh
$ nswift download <swift_path> # nswift download assets/robots.txt > my-robots.txt
```
```sh
$ nswift delete <swift_path> # nswift delete assets/robots.txt
```
@@ -181,12 +235,20 @@
upload = NightcrawlerSwift::Upload.new
upload.execute "my_file_path.txt", File.open("../my_file_fullpath.txt", "r")
# true / false
```
-_This upload command was not designed to send very large files_
+_This upload command was not designed to send very large files_.
+It will accept a custom max-age, overriding the configured value through ```NightcrawlerSwift.configure```, example:
+
+```ruby
+upload = NightcrawlerSwift::Upload.new
+upload.execute "readme", File.open("readme.md", "r"), max_age: 300
+# true / false
+```
+
### Download
```ruby
download = NightcrawlerSwift::Download.new
download.execute "my_file_path.txt"
@@ -199,9 +261,19 @@
```ruby
list = NightcrawlerSwift::List.new
list.execute
# [{"hash": "...", "name": "my_file_path.txt"}, {}, {}, ...]
+```
+
+This command supports the following parameters: __limit, marker, end_marker, prefix, format, delimiter, path__
+
+Example:
+
+```ruby
+list = NightcrawlerSwift::List.new
+list.execute prefix: '/some/path'
+# [{"hash": "...", "name": "/some/path/with/my_file_path.txt"}, {}, {}, ...]
```
### Delete
```ruby