generated from coldbox-modules/module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
132 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,19 @@ | |
component { | ||
|
||
// Module Properties | ||
this.title = "@MODULE_NAME@"; | ||
this.title = "ipify"; | ||
this.author = "Ortus Solutions"; | ||
this.webURL = "https://www.ortussolutions.com"; | ||
this.description = "@MODULE_DESCRIPTION@"; | ||
this.description = " A Simple Public IP Address API Module based on www.ipify.org"; | ||
this.version = "@build.version@[email protected]@"; | ||
|
||
// Model Namespace | ||
this.modelNamespace = "@MODULE_SLUG@"; | ||
|
||
this.modelNamespace = "ipify"; | ||
// CF Mapping | ||
this.cfmapping = "@MODULE_SLUG@"; | ||
|
||
this.cfmapping = "ipify"; | ||
// Dependencies | ||
this.dependencies = []; | ||
// Helpers | ||
this.applicationHelper = [ "helpers/mixins.cfm" ]; | ||
|
||
/** | ||
* Configure Module | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name" : "@MODULE_NAME@", | ||
"name" : "ipify", | ||
"version" : "1.0.0", | ||
"location" : "https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/@MODULE_SLUG@/@build.version@/@MODULE_SLUG@[email protected]@.zip", | ||
"location" : "https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/ipify/@build.version@/ipify[email protected]@.zip", | ||
"author" : "Ortus Solutions <[email protected]>", | ||
"homepage" : "https://github.com/coldbox-modules/@MODULE_SLUG@", | ||
"documentation" : "https://github.com/coldbox-modules/@MODULE_SLUG@", | ||
"repository" : { "type" : "git", "url" : "https://github.com/coldbox-modules/@MODULE_SLUG@" }, | ||
"bugs" : "https://github.com/coldbox-modules/@MODULE_SLUG@", | ||
"homepage" : "https://github.com/coldbox-modules/ipify", | ||
"documentation" : "https://github.com/coldbox-modules/ipify", | ||
"repository" : { "type" : "git", "url" : "https://github.com/coldbox-modules/ipify" }, | ||
"bugs" : "https://github.com/coldbox-modules/ipify", | ||
"shortDescription" : "Description goes here", | ||
"slug" : "@MODULE_SLUG@", | ||
"slug" : "ipify", | ||
"type" : "modules", | ||
"keywords":"", | ||
"license" : [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<cfscript> | ||
function myIp(){ | ||
return getInstance( "@ipify" ).get(); | ||
} | ||
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Tap into the ipify API for public address retrieval | ||
*/ | ||
component { | ||
|
||
variables.API_URL = "https://api.ipify.org/?format=json"; | ||
|
||
function init(){ | ||
return this; | ||
} | ||
|
||
/** | ||
* Get the public IP Url of the caller | ||
*/ | ||
string function get(){ | ||
cfhttp( | ||
method = "GET", | ||
charset = "utf-8", | ||
url = variables.API_URL, | ||
result = "local.results" | ||
); | ||
return deserializeJSON( results.fileContent ).ip; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,68 @@ | ||
# Ortus ColdBox Module Template | ||
# IPIFY API Module | ||
|
||
This template can be used to create Ortus based ColdBox Modules. To use, just click the `Use this Template` button in the github repository: https://github.com/coldbox-modules/module-template and run the setup task from where you cloned it. | ||
This module allows you to tap into the ipify API: https://www.ipify.org/ : A Simple Public IP Address API, to get the IP address of where you made the call from; your public IP Address. | ||
|
||
```bash | ||
box task run taskFile=build/setupTemplate | ||
``` | ||
## LICENSE | ||
|
||
Apache License, Version 2.0. | ||
|
||
## IMPORTANT LINKS | ||
|
||
* Source: https://github.com/coldbox-modules/ipify | ||
* ForgeBox: http://forgebox.io/view/ipify | ||
* [Changelog](changelog.md) | ||
|
||
## SYSTEM REQUIREMENTS | ||
|
||
The `setupTemplate` task will ask you for your module name, id and description and configure the template for you! Enjoy! | ||
* Lucee 5+ | ||
* ColdFusion 2018+ | ||
|
||
## Directory Structure | ||
## Why ipify? | ||
|
||
The root of the module is the root of the repository. Add all the necessary files your module will need. | ||
* Ever needed to get your public IP address programmatically? | ||
* Maybe you're provisioning new cloud servers and need to know your IP -- maybe you're behind a corporate firewall and need to tunnel information -- whatever the reason: sometimes having a public IP address API is useful! | ||
* ipify is completely open source (check out the GitHub repository): https://github.com/rdegges/ipify-api | ||
|
||
* `.github/workflows` - These are the github actions to test and build the module via CI | ||
* `build` - This is the CommandBox task that builds the project. Only modify if needed. Most modules will never modify it. (Modify if needed) | ||
* `test-harness` - This is a ColdBox testing application, where you will add your testing files, specs etc. | ||
* `.cfformat.json` - A CFFormat using the Ortus Standards | ||
* `.cflintrc` - A CFLint configuration file according to Ortus Standards | ||
* `.editorconfig` - Smooth consistency between editors | ||
* `.gitattributes` - Git attributes | ||
* `.gitignore` - Basic ignores. Modify as needed. | ||
* `.markdownlint.json` - A linting file for markdown docs | ||
* `box.json` - The box.json for YOUR module. Modify as needed. | ||
* `changelog.md` - A nice changelog tracking file | ||
* `ModuleConfig.cfc` - Your module's configuration. Modify as needed. | ||
* `readme.md` - Your module's readme. Modify as needed. | ||
* `[email protected]` - A set of json files to configure the major engines your modules supports. | ||
## Installation | ||
|
||
## Test Harness | ||
Just do `box install ipify` and you are ready to roll! | ||
|
||
The test harness is created to bootstrap your working module into the application `afterAspectsLoad`. This is done in the `config/ColdBox.cfc`. It includes some key features: | ||
## Usage | ||
|
||
* `config` - Modify as needed | ||
* `tests` - All your testing specs should go here. Please notice the commented out ORM fixtures. Enable them if your module requires ORM | ||
* `.cfconfig.json` - A prepared cfconfig json file so your engine data is consistent. Modify as needed. | ||
* `.env.sample` - An environment property file sample. Copy and create a `.env` if your app requires it. | ||
You can get access to our model, or helper to get your public IP address | ||
|
||
```js | ||
// Via getInstance: handlers/layouts/views/interceptors | ||
getInstance( "ipify" ).get() | ||
|
||
// Via injection: anywhere | ||
property name="ipify" inject="@ipify"; | ||
var ip = ipify.get(); | ||
|
||
// As a delegate: anywhere | ||
component delegates="ip<@ipify" | ||
// Then use with the ip suffix: getIp() | ||
|
||
// As a helper: handlers/layouts/views/interceptors | ||
getMyIp() | ||
``` | ||
|
||
## API Docs | ||
******************************************************************************** | ||
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp | ||
www.ortussolutions.com | ||
******************************************************************************** | ||
|
||
The build task will take care of building API Docs using DocBox for you but **ONLY** for the `models` folder in your module. If you want to document more then make sure you modify the `build/Build.cfc` task. | ||
## HONOR GOES TO GOD ABOVE ALL | ||
|
||
## Github Actions Automation | ||
Because of His grace, this project exists. If you don't like this, then don't read it, its not for you. | ||
|
||
The github actions will clone, test, package, deploy your module to ForgeBox and the Ortus S3 accounts for API Docs and Artifacts. So please make sure the following environment variables are set in your repository. ** Please note that most of them are already defined at the org level ** | ||
>"Therefore being justified by faith, we have peace with God through our Lord Jesus Christ: | ||
By whom also we have access by faith into this grace wherein we stand, and rejoice in hope of the glory of God. | ||
And not only so, but we glory in tribulations also: knowing that tribulation worketh patience; | ||
And patience, experience; and experience, hope: | ||
And hope maketh not ashamed; because the love of God is shed abroad in our hearts by the | ||
Holy Ghost which is given unto us. ." Romans 5:5 | ||
|
||
* `FORGEBOX_TOKEN` - The Ortus ForgeBox API Token | ||
* `AWS_ACCESS_KEY` - The travis user S3 account | ||
* `AWS_ACCESS_SECRET` - The travis secret S3 | ||
### THE DAILY BREAD | ||
|
||
> Please contact the admins in the `#infrastructure` channel for these credentials if needed | ||
> "I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
<cfoutput> | ||
Module Tester | ||
</cfoutput> | ||
<h2> | ||
My IP is: #getInstance( "@ipify" ).get()# | ||
</h2> | ||
<h2> | ||
My helper IP is: #myIp()# | ||
</h2> | ||
</cfoutput> |