Skip to content

Commit

Permalink
Implemented CREATE_CONTAINER and LIST_BLOBS
Browse files Browse the repository at this point in the history
  • Loading branch information
Karm committed Aug 31, 2017
1 parent 69a1acf commit 6ce66df
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 44 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ if(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 /Wall /Z7")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Od /Wall /Zi")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -std=gnu99 -fPIC -Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -std=c99 -fPIC -Wall -Wextra")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -p -O1 -std=gnu99 -fPIC -Wall -Wextra")
endif()
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})

find_package(CURL REQUIRED)
find_package(APR REQUIRED)

find_package(OpenSSL REQUIRED)

include_directories(${CURL_INCLUDE_DIR})
include_directories(${APR_INCLUDE_DIR})

include_directories(${APRUTIL_INCLUDE_DIR})
include_directories(${OPENSSL_INCLUDE_DIR})

aux_source_directory(src SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES} ${APR_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES} ${APR_LIBRARIES} ${APRUTIL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY})
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,63 @@
# mod_cloud_storage
Storing and reading BLOBs to and from a cloud service.

# Building
* cmake
* APR, APR Util
* OpenSSL

# Releases and Downloads

See [Releases](https://github.com/Karm/mod_cloud_storage/releases)

# Usage

The command line tool is controlled via env variables and command line arguments. Command line arguments take priority and overwrite env variables settings.

## Env variables
```
MCS_ACTION=READ_BLOB|WRITE_BLOB|LIST_BLOBS|CREATE_CONTAINER
MCS_AZURE_STORAGE_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
MCS_AZURE_STORAGE_ACCOUNT=devstoreaccount1
MCS_AZURE_BLOB_NAME=test
MCS_AZURE_CONTAINER=your-container
MCS_PATH_TO_FILE=/tmp/meh
MCS_BLOB_STORE_URL=127.0.0.1:10000
MCS_TEST_REGIME=true|false
```

## Command line arguments
```
--action
--azure_storage_key
--azure_storage_account
--blob_name
--azure_container
--path_to_file
--blob_store_url
--test_regime
```

*Only LIST_BLOBS and CREATE_CONTAINER are implemented at the moment.*

## Testing and fooling around
* get your [Azurite container up and running](https://github.com/arafato/azurite#docker-image)
* ```
./mod_cloud_storage \
--action CREATE_CONTAINER \
--azure_storage_key Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw== \
--azure_storage_account devstoreaccount1 \
--azure_container my-first-container \
--blob_store_url 127.0.0.1:10000 \
--test_regime true
```

## Working with real Azure storage
* See Azure Portal and Azure Docs on creating Storage Account
* Copy your access key from your Azure Portal
* set test_regime to false or leave it blank
* set blob_store_url to blob.core.windows.net
* set azure_storage_account to your actual storage account name
* *Do not use a storage account with valuable containers in it. This tool is just a toy.*


Loading

0 comments on commit 6ce66df

Please sign in to comment.