{"id":16484912,"url":"https://github.com/stephenmoloney/arc_ovh","last_synced_at":"2025-10-27T17:32:17.559Z","repository":{"id":57478957,"uuid":"88907469","full_name":"stephenmoloney/arc_ovh","owner":"stephenmoloney","description":"An ovh storage adapter for arc.","archived":false,"fork":false,"pushed_at":"2017-11-02T15:35:41.000Z","size":373,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T07:31:37.857Z","etag":null,"topics":["arc","cloud-storage","elixir","file-storage","ovh"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/arc_ovh","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephenmoloney.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-20T20:25:43.000Z","updated_at":"2024-06-22T11:21:10.000Z","dependencies_parsed_at":"2022-09-18T05:45:06.629Z","dependency_job_id":null,"html_url":"https://github.com/stephenmoloney/arc_ovh","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Farc_ovh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Farc_ovh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Farc_ovh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Farc_ovh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenmoloney","download_url":"https://codeload.github.com/stephenmoloney/arc_ovh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238486149,"owners_count":19480465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arc","cloud-storage","elixir","file-storage","ovh"],"created_at":"2024-10-11T13:18:41.470Z","updated_at":"2025-10-27T17:32:12.234Z","avatar_url":"https://github.com/stephenmoloney.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ArcOvh\n\nUse Arc with the [OVH Cloudstorage](https://www.ovh.co.uk/public-cloud/storage/)\n\n\n## Installation\n\nThe package can be installed by adding `arc_ovh` to your\nlist of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:arc_ovh, \"~\u003e 0.2\"}]\nend\n```\n\n\n## Configuration\n\n  - Configure the Arc Storage adapter\n```elixir\nconfig :arc,\n  storage: Arc.Storage.Ovh.Cloudstorage,\n  client: ArcOvh.Client.Cloudstorage,\n  container: \"default\",\n  default_tempurl_ttl: (30 * 24 * 60 * 60), # 30 days default time to live for signed urls.\n  version_timeout: (60 * 3 * 1000) # 3 minutes\n```\n\n  - Configure the OVH client\n```elixir\nconfig :arc_ovh, ArcOvh.Client.Cloudstorage,\n    adapter: Openstex.Adapters.Ovh,\n    ovh: [\n      application_key: System.get_env(\"APPLICATION_KEY\"),\n      application_secret: System.get_env(\"APPLICATION_SECRET\"),\n      consumer_key: System.get_env(\"CONSUMER_KEY\")\n    ],\n    keystone: [\n      tenant_id: System.get_env(\"TENANT_ID\"), # mandatory, corresponds to an ovh project id or ovh servicename\n      user_id: System.get_env(\"USER_ID\"), # optional, if absent a user will be created using the ovh api.\n      endpoint: \"https://auth.cloud.ovh.net/v2.0\"\n    ],\n    swift: [\n      account_temp_url_key1: System.get_env(\"TEMP_URL_KEY1\"), # defaults to :nil if absent\n      account_temp_url_key2: System.get_env(\"TEMP_URL_KEY2\"), # defaults to :nil if absent\n      region: :nil # specify a region if you like. Check your OVH cloud.\n    ],\n    hackney: [\n      timeout: 20000,\n      recv_timeout: 40000\n    ]\n\nconfig :httpipe,\n  adapter: HTTPipe.Adapters.Hackney\n```\n\n\n## Example usage\n\n  - Create Definition (see [arc](https://github.com/stavro/arc) for more information)\n\n```elixir\ndefmodule DummyDefinitionThumbnail do\n    use Arc.Definition\n    @versions [:original, :thumbnail]\n\n    def transform(:thumbnail, _) do\n      {\"convert\", \"-strip -thumbnail 100x100^ -gravity center -extent 100x100 -format jpg\", :jpg}\n    end\n    # Whitelist file extensions:\n    def validate({file, _}) do\n      file_extension = file.file_name |\u003e Path.extname() |\u003e String.downcase()\n      file_extension in ~w(.jpg .jpeg .gif .png)\n    end\n    def __storage(), do: Application.get_env(:arc, :storage, Arc.Storage.Ovh.Cloudstorage)\n\n    def storage_dir(_version, {_file, scope}) do\n      (scope != :nil \u0026\u0026 Map.has_key?(scope, :id)) \u0026\u0026\n       \"#{scope.id}\" ||\n       \"\"\n    end\n    def storage_dir(_version, _) do\n       \"\"\n    end\n\n    def filename(version, {file, _scope}) do\n      \"#{Path.basename(file.file_name) |\u003e Path.rootname()}_#{version}\"\n    end\nend\n```\n\n   - Store an image and generate a url for the\n   `:original` version and `:thumbnail` version\n\n```elixir\ndefp image(), do: Path.join(__DIR__, \"./assets/image.jpg\") |\u003e Path.expand()\n\n{:ok, object_name} = DummyDefinitionThumbnail.store({image(), %{id: 1}})\noriginal_url = DummyDefinitionThumbnail.url({image(), %{id: 1}}, :original)\nthumbnail_url = DummyDefinitionThumbnail.url({image(), %{id: 1}}, :thumbnail)\n```\n\n   - Store an image and generate a signed url for the\n   `:original` version and `:thumbnail` version\n\n```elixir\ndefp image(), do: Path.join(__DIR__, \"./assets/image.jpg\") |\u003e Path.expand()\n\n{:ok, object_name} = DummyDefinitionThumbnail.store({image(), %{id: 1}})\noriginal_signed_url = DummyDefinitionThumbnail.url({image(), %{id: 1}}, :original, signed: :true)\nthumbnail_signed_url = DummyDefinitionThumbnail.url({image(), %{id: 1}}, :thumbnail, signed: :true)\n```\n\n   - Delete an image for all versions.\n\n```elixir\n{:ok, object_name} = DummyDefinitionThumbnail.store({image(), %{id: 1}})\n:ok = DummyDefinitionThumbnail.delete({object_name, %{id: 1}})\n```\n\n\n## Tests\n\n- Tests are run against a container named `arc_ovh_test_container` on an ovh\nopenstack server.\n\n- Create a `test.exs` file in `config.exs` and setup a [Configuration](## Configuration)\n\n- `mix test`\n\n- The image used in the tests was taken in bundoran Ireland by me a few years back.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/stephenmoloney/arc_ovh/blob/master/test/fixtures/bundoran.jpg?raw=true\" width=\"600\"\u003e\n\u003c/p\u003e\n\n\n\n## License\n\n[MIT Licence](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenmoloney%2Farc_ovh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenmoloney%2Farc_ovh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenmoloney%2Farc_ovh/lists"}